提供参数时SOAP请求失败

Chi*_*ief 3 .net soap web-services asmx fiddler

当我使用参数orderid调用我的Soap ASMX服务时,它失败并说.有任何想法吗?

System.InvalidOperationException: Request format is invalid: text/xml; charset=utf-8.
   at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Run Code Online (Sandbox Code Playgroud)

public class Service1:System.Web.Services.WebService {

    [WebMethod(EnableSession=true)]
    [SoapDocumentMethod]

    public Order MyLiteralMethod([XmlElement("MyOrderID")] string orderId)
    {

       //logic
    }
}
Run Code Online (Sandbox Code Playgroud)

FIDDLER REQUEST HEADER

Host: localhost:49033
Content-Type: text/xml; charset=utf-8
Content-Length: 369
SOAPAction: "http://tempuri.org/MyLiteralMethod"
Run Code Online (Sandbox Code Playgroud)

FIDDLER请求身体

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <MyLiteralMethod xmlns="http://tempuri.org/">
      <MyOrderID>sdasd</MyOrderID>
    </MyLiteralMethod>
  </soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

进一步的发现 我能够从其他Web调试代理工具[STORM]调用服务并传递参数.我认为这是针对小提琴手的

问题已解决

看起来像fiddler .went into tools-> options-> https的问题.删除解密HTTPs流量..重新启动的fiddler.然后重新添加这些选项并重新启动.我不知道这个过程是否解决了这个问题,但我可以通过提琴手提出请求.

Mat*_*ieu 18

我对旧的ASMX服务遇到了同样的问题(这与Fiddler没有任何关系).解:

您正在使用SOAP协议调用Web服务.我猜你用来调用它的URL是:

http://yourserver/service.asmx/methodOfService
Run Code Online (Sandbox Code Playgroud)

但是,当您对服务执行简单的GET或POST时(例如,使用AJAX时),必须使用此URL.使用SOAP时,必须使用以下URL:

http://yourserver/service.asmx
Run Code Online (Sandbox Code Playgroud)

没有方法名称,因为它包含在SOAP正文中.


Eri*_*Law 0

Fiddler 在这里并没有做什么神奇的事情。最简单的方法是使用 Fiddler 捕获工作请求,然后使用比较功能将其与从 Composer 选项卡发出的非工作请求进行比较。

您是否记得将 HTTP Verb 设置为POST

如果去掉字符集前面的空格,会有变化吗?Content-Type: text/xml;charset=utf-8