【发布时间】:2013-08-15 01:48:13
【问题描述】:
当我使用参数 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()
公共类 Service1 : System.Web.Services.WebService {
[WebMethod(EnableSession=true)] [SoapDocumentMethod] public Order MyLiteralMethod([XmlElement("MyOrderID")] string orderId) { //logic } }
提琴手请求标头
Host: localhost:49033
Content-Type: text/xml; charset=utf-8
Content-Length: 369
SOAPAction: "http://tempuri.org/MyLiteralMethod"
提琴手请求正文
<?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>
进一步的发现 我可以从其他 Web 调试代理工具 [STORM] 调用服务并传递参数。我认为这是特定于提琴手的
问题已解决
似乎是提琴手的问题。进入工具->选项->https ..删除了解密HTTPS流量..重新启动了提琴手。然后重新添加这些选项并重新启动。我不知道这个过程是否解决了问题,但我可以通过 fiddler 提出请求。
【问题讨论】:
-
ASMX 是一项遗留技术,不应用于新开发。 WCF 应该用于 Web 服务客户端和服务器的所有新开发。一个提示:微软已经在 MSDN 上停用了ASMX Forum。
-
@JohnSaunders 感谢您的提示,但不幸的是,我不得不根据当前的基础架构和业务需求使用该提示
标签: .net web-services soap asmx fiddler