【问题标题】:Web Service Adding extra forward slash in SOAPActionWeb 服务在 SOAPAction 中添加额外的正斜杠
【发布时间】:2013-12-01 18:59:35
【问题描述】:

我正在使用 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 正在添加正斜杠。

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

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      通过查看代码、创建模拟示例等,我没有发现问题。是的,我确实看到了您在帖子中提到的额外正斜杠,但这是设计使然。这就是 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://&lt;web host&gt;/SupplierEngagement.asmx?wsdl

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-01-19
        • 1970-01-01
        • 2021-08-24
        • 2021-03-15
        • 1970-01-01
        • 2022-01-10
        • 2023-04-11
        • 1970-01-01
        相关资源
        最近更新 更多