asp.net – 使用Web服务导致“无法处理没有有效操作参数的请求”
我需要在此.NET站点上使用Web服务:
https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx 对于初步消费,我使用Fiddler或curl.两者都给出了同样的错误: <faultstring>Unable to handle request without a valid action parameter. Please supply a valid soap action.</faultstring> 我的卷曲命令: curl -d @ GetVersionNumber.xml https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx 请参阅下面的文件GetVersionNumber.xml: <?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> <GetVersionNumber xmlns="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData" /> </soap:Body> </soap:Envelope> 添加SOAP-ENV:Header作为soap中的元素:Envelope没有帮助 <SOAP-ENV:Header Content-Type="text/xml" Host="www.iyardiasp.com" SOAPAction="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber"/> 将Soap Action添加为标头无济于事. 在这种情况下,curl命令是: curl -H“SOAPAction:http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber”-d @ GetVersionNumber.xml“https://www.iyardiasp.com/8223third_17/webservices/itfapplicantscreening.asmx” 响应是: <faultstring>Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber.</faultstring> 解决方法
您需要提供
SOAPAction as a HTTP header,而不是SOAP标头.以下是使用SoapUI执行完整请求时的样子(请注意第四行):
POST /8223third_17/webservices/ItfResidentData.asmx HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber" User-Agent: Jakarta Commons-HttpClient/3.1 Host: www.iyardiasp.com Content-Length: 260 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itf="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData"> <soapenv:Body> <itf:GetVersionNumber/> </soapenv:Body> </soapenv:Envelope> 对于curl,您可以使用 如果你确实需要使用curl,请尝试这样的事情(所有必须在一行;为了便于阅读,将其分开): curl -H "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction: "http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData/GetVersionNumber"" -d @GetVersionNumber.xml https://www.iyardiasp.com/8223third_17/webservices/ItfResidentData.asmx 在GetVersionNumber.xml文件中使用它: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:itf="http://tempuri.org/YSI.Interfaces.WebServices/ItfResidentData"> <soapenv:Body> <itf:GetVersionNumber/> </soapenv:Body> </soapenv:Envelope> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – Asp.Net MVC捆绑,最好的方式来检测丢失的文
- asp.net – 通过控件循环
- ASP.NET Mvc Api:设置cookie然后302/303 Redirect丢失cook
- MVC中TempData、ViewData和ViewBag的区别
- 使用 C# 捕获进程输出
- asp.net – 如何在MVC 3中设置图表系列颜色?
- asp.net – 将MVC 2项目升级到MVC 5
- asp.net – 如何在EditItemTemplate中使用Bind()获取可空属
- asp.net-mvc – Html.DisplayFor不发布值到控制器在ASP.NET
- 在ASP.NET MVC 6中继续支持Ninject?