当前位置: 首页 > news >正文

郑州代理记账网站建设现在建设网站都用什么软件下载

郑州代理记账网站建设,现在建设网站都用什么软件下载,wordpress 安装文件,php在网站制作中的运行机制一、问题说明 1.1 问题描述 使用C# 搭建WebService接口#xff0c;并按照ESB平台人员的要求#xff0c;将命名空间改为http://esb.webservice,使用PostmanESB平台人员提供的入参示例进行测试时#xff0c;callBussiness接口参数message始终为null。 以下是ES…一、问题说明 1.1 问题描述 使用C# 搭建WebService接口并按照ESB平台人员的要求将命名空间改为http://esb.webservice,使用PostmanESB平台人员提供的入参示例进行测试时callBussiness接口参数message始终为null。 以下是ESB平台提供的模版 ?xml version1.0 encodingutf-8? soapenv:Envelope xmlns:soapenvhttp://schemas.xmlsoap.org/soap/envelope/ xmlns:esbhttp://esb.webservicesoapenv:Header/soapenv:Bodyesb:callBussiness!--Optional:--message![CDATA[...]]/message/esb:callBussiness/soapenv:Body /soapenv:Envelope1.2 C# WebService代码 using System; using System.IO; using System.Text; using System.Web.Services; using System.Xml; using System.Xml.Serialization; using Rss_WebServer.code;namespace ESB {/// summary/// WebService 的摘要说明/// /summary[WebService(Namespace http://esb.webservice)][WebServiceBinding(ConformsTo WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)]// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务请取消注释以下行。 // [System.Web.Script.Services.ScriptService]public class WebService : System.Web.Services.WebService{[WebMethod(Description 调用业务)]public string callBussiness(string message){return message; }} }1.3 Postman 测试参数 POST http://localhost:55305/WebService.asmx?opcallBussiness Headers KEYVALUEDESCRIPTIONContent-Typetext/xml; charsetutf-8SOAPAction“http://esb.webservice/callBussiness” Body raw XML(text/xml) ?xml version1.0 encodingutf-8? soapenv:Envelope xmlns:soapenvhttp://schemas.xmlsoap.org/soap/envelope/ xmlns:esbhttp://esb.webservicesoapenv:Header/soapenv:Bodyesb:callBussiness!--Optional:--message![CDATA[rootauthor少莫千华/authoremail370763160qq.com/email/root]]/message/esb:callBussiness/soapenv:Body /soapenv:Envelope二、问题分析 根本问题是ESB平台提供的参数模版并没有完全按照标准的WebService协议进行编写导致使用官方搭建的WebService接口无法正常的解析参数所以要想解决此问题有两个途径 与ESB平台人员沟通要求其标准化参数模版 自己重新解构WebService参数 三、解决方案 3.1 与ESB平台人员沟通要求其标准化参数模版 3.1.1 标准模版 - 使用命名空间缩写 对callBussiness接口的message参数添加命名空间缩写esb ?xml version1.0 encodingutf-8? soapenv:Envelope xmlns:soapenvhttp://schemas.xmlsoap.org/soap/envelope/ xmlns:esbhttp://esb.webservicesoapenv:Header/soapenv:Bodyesb:callBussiness!--Optional:--esb:message![CDATA[...]]/esb:message/esb:callBussiness/soapenv:Body /soapenv:Envelope3.1.1 标准模版 - 使用完整的命名空间 对callBussiness接口的使用完整的命名空间callBussiness xmlnshttp://esb.webservice。 ?xml version1.0 encodingutf-8? soapenv:Envelope xmlns:soapenvhttp://schemas.xmlsoap.org/soap/envelope/soapenv:Header/soapenv:BodycallBussiness xmlnshttp://esb.webservice!--Optional:--message![CDATA[...]]/message/callBussiness/soapenv:Body /soapenv:Envelope3.2 自己重新解构WebService参数 从请求对象base.Context.Request中重新获取所有Body内容(InputStream)然后再进行自定义解析。 注因为是搭建的标准的WebService接口Body内容(InputStream)在进去函数内部前已经被SOAP协议解析过一次所以InputStream的起始内容位置Position 指向数据流的结尾所以在读取之前先要将InputStream的起始内容位置Position设置为0否则读取的内容为空() using System; using System.IO; using System.Text; using System.Web.Services; using System.Xml; using System.Xml.Serialization; using Rss_WebServer.code; namespace ESB {/// summary/// WebService 的摘要说明/// /summary[WebService(Namespace http://esb.webservice)][WebServiceBinding(ConformsTo WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)]// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务请取消注释以下行。 // [System.Web.Script.Services.ScriptService]public class WebService : System.Web.Services.WebService{[WebMethod(Description 调用业务)]public string callBussiness(string message){try{if (string.IsNullOrEmpty(message)){message WebServiceAnalysis(base.Context.Request, nameof(message));}return message;}catch(Exception exp){return exp.Message;}}/// summary/// 重新解析 WebService/// /summary/// param namerequest/param/// param namename/param/// returns/returnsprivate string WebServiceAnalysis(System.Web.HttpRequest request,string name){try{if(request.ContentLength 0){throw new Exception($Body(xml数据) 无数据);}// 获取请求内容Stream inputStream request.InputStream;// 重新获取内容inputStream.Position 0;// 读取请求主体内容using (StreamReader reader new StreamReader(inputStream, Encoding.UTF8)){string requestBody reader.ReadToEnd();XmlDocument xmlDoc new XmlDocument();xmlDoc.LoadXml(requestBody);XmlNode strNode xmlDoc.SelectSingleNode($//{name});if (strNode ! null){return strNode.InnerText;}else{throw new Exception($未在Body(xml数据)找到{name}节点);}}}catch(Exception exp){throw exp;}}} }
http://www.zqtcl.cn/news/42084/

相关文章:

  • 企业网站 建设公司网站设计师对应的专业
  • 双色调网站离石网站建设公司
  • 网站单页面制作海宁公司做网站
  • PS的网站linchong.wordpress
  • 唐山正规做网站的公司广告设计图片大全 模板
  • 青岛市网站建设如何做实验室网站
  • 中山网站建设案例深圳市公司排名
  • 儿童网站模板 html泉州seo搜索优化合作
  • 做相册的网站dw邯郸 网站建设
  • 网站安全建设方案青岛做网站电话
  • 企业网站货物查询怎么做如何设计一个高端网站简洁大方大气
  • 深圳建设材料价格网站dw网页设计图片轮播切换
  • 建立网站的详细步骤知乎绍兴手机网站建设
  • 电子商务网站调研安阳网站建设优化渠道
  • 导航网站搭建镜像的网站怎么做排名
  • 020网站开发深圳十大活动策划公司
  • 网站推广的具体方案手机版企业网站
  • 天津网站设计公司排名网站外链建设大揭秘
  • 爱站网关键词查询工具小程序小游戏开发
  • 企业网站建设文章国外购物平台网页界面设计
  • 推广网站广告网站后台怎么做图片链接
  • 2016wap网站开发语言wordpress显示特效
  • php 视频播放网站开发企业宣传视频模板免费下载
  • 百捷网站建设工资seo基础理论
  • 站长之家ip地址查询制作wordpress模板教程视频教程
  • 奖励网站代码个人网站名称怎么取容易备案
  • 宝塔面板怎么做多个网站西安网站制作公司哪家好
  • 网站建设方案评标原则网站二维码链接怎么做
  • 国家企业官方网站查询系统怎么在拼多多上开网店卖东西
  • 青浦网站建设推广wordpress前端登录问题