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

手机qq钓鱼网站怎么做做模拟人生比较有名的网站

手机qq钓鱼网站怎么做,做模拟人生比较有名的网站,广州手机网站,wordpress衔接出错一、问题说明 1.1 问题描述 使用C# 搭建WebService接口,并按照ESB平台人员的要求,将命名空间改为"http://esb.webservice",使用PostmanESB平台人员提供的入参示例进行测试时,callBussiness接口参数message始终为null。 以下是ES…

一、问题说明

1.1 问题描述

使用C# 搭建WebService接口,并按照ESB平台人员的要求,将命名空间改为"http://esb.webservice",使用Postman+ESB平台人员提供的入参示例进行测试时,callBussiness接口参数message始终为null

以下是ESB平台提供的模版

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esb="http://esb.webservice"><soapenv:Header/><soapenv:Body><esb:callBussiness><!--Optional:--><message><![CDATA[...]]></message></esb:callBussiness></soapenv:Body>
</soapenv:Envelope>

1.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?op=callBussiness
  • Headers
KEYVALUEDESCRIPTION
Content-Typetext/xml; charset=utf-8
SOAPAction“http://esb.webservice/callBussiness”
  • Body
    • raw XML(text/xml)
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esb="http://esb.webservice"><soapenv:Header/><soapenv:Body><esb:callBussiness><!--Optional:--><message><![CDATA[<root><author>少莫千华</author><email>370763160@qq.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 version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:esb="http://esb.webservice"><soapenv:Header/><soapenv:Body><esb:callBussiness><!--Optional:--><esb:message><![CDATA[...]]></esb:message></esb:callBussiness></soapenv:Body>
</soapenv:Envelope>

3.1.1 标准模版 - 使用完整的命名空间

callBussiness接口的使用完整的命名空间<callBussiness xmlns="http://esb.webservice">

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><callBussiness xmlns="http://esb.webservice"><!--Optional:--><message><![CDATA[...]]></message></callBussiness></soapenv:Body>
</soapenv:Envelope>

3.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 name="request"></param>/// <param name="name"></param>/// <returns></returns>private 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.yayakq.cn/news/968986/

相关文章:

  • 杭州手机网站制作电脑公司基本营销策略有哪些
  • 做网站维护费是怎么算的私人承接软件开发定制
  • 网站建设技术网站建谈谈网站建设会有哪些问题
  • 网站建设学手机网站用什么软件做的好
  • 电话销售企业网站怎么做wordpress自媒体新闻模板
  • 普宁网站建设雅安做网站
  • 做外单网站有哪些wordpress琪亚娜
  • c网站开发源代码做h的小说网站有哪些
  • 网站开发语音优化大师免费版
  • 双域名网站直播平台开发费用
  • 一个ip可以建设多少个网站苏州网络推广定制
  • 公司免费网站wordpress如何设置用户登录
  • 网络安全网站wordpress jpress
  • 类似猪八戒的网站建设广州seo好找工作吗
  • 正规的佛山网站建设价格注册账号
  • 如何自己做网站手机行业门户网站 建站
  • 长春做公司网站国内十大网站排名
  • 和动物做的网站WordPress网页编辑插件
  • 门户网站后台管理模板制作网页网站用的是什么
  • 网站开发网站设计制作团购网站建设怎么样
  • wordpress淘宝客网站模板深圳做积分商城网站建设
  • 哪个做网站wordpress nas 外网
  • 购物网站建设的目的麻将app软件开发价格
  • 网站网页设计案例手机可以设计网站吗
  • 学生网站建设的总结与评价做旅游信息的网站能赚钱吗
  • 雏鸟app网站推广wordpress去除版本号
  • 网站的seo如何优化昆明公司做网站
  • 宁波公司有哪些怎样做网站标题优化
  • 珠宝类网站模板代理服务器怎么设置
  • 微网站开发价格php网站怎么搭建环境配置