Web服务在SOAPAction中添加额外的正斜杠

时间:2013-11-18 15:03:49

标签: asp.net vb.net web-services soap soap-client

我正在使用SoapUI来测试将由Java客户端应用程序使用的.Net Web服务。

当我将Web服务连接到SoapUI但更新WSDL位置并调用其中一个预设测试脚本时,Web服务失败并显示以下代码

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:/AppointSupplier.
   at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)    
         </faultstring>
         <detail/>
      </soap:Fault>    
   </soap:Body>
</soap:Envelope>

从上面的错误可以看出,问题在于SOAPAction参数有一个额外的正斜杠。

我在课堂上使用以下属性:

<WebService(Namespace:= "urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:AppointSupplier")>

以及方法调用的以下属性:

<WebMethod(MessageName:="appointSupplierRq")>

从这些开始,.Net正在添加正斜杠。

必须可以删除自动生成的正斜杠。

2 个答案:

答案 0 :(得分:0)

从查看代码,创建模拟样本等,我没有看到问题。是的,我确实看到你在帖子中提到的额外正斜杠,但这是设计的。这就是ASMX服务如何记录类中要执行的方法。

现在,根据您的SOAP消息和WebService \ WebMethod属性,有些内容不同步。您的SOAP标头操作应该是

urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:AppointSupplier/appointSupplierReq

urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:/AppointSupplier

这让我相信你没有将SOAP UI项目更新为新生成的WSDL。尝试在SOAP UI中创建一个新项目,指向ASMX Web服务的WSDL文件,例如。

http://<web host>/SupplierEngagement.asmx?wsdl

运行测试方法。如果这不能解决问题,请发布(作为编辑)SupplierEngagement asmx文件的完整类(您可以省略方法内容),因为我们只对完整设置感兴趣。

答案 1 :(得分:0)

我有一个类似的问题,最终是服务器端的权限问题,提供正斜杠错误,但可以做其他事情来诊断问题

Can the SoapAction of a SOAP REQUEST be altered by interoperability issues between .NET and JAVA or a network/infraestructure proxy