自定义绑定以支持Soap11WSAddressing10导致ActionMismatch错误

时间:2012-05-21 11:03:53

标签: c# .net wcf web-services soap

我有一个定义的wsdl来支持互操作性,其中soap 1.1需要支持wsaddressing。因此,我已经设置了我的服务,因此使用自定义绑定配置了我的wcf服务,如下所示。

 <customBinding>
  <binding name="CustomWsHttpSoap11" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
    <textMessageEncoding messageVersion="Soap11WSAddressing10"/>
    <httpTransport maxReceivedMessageSize="2147483647" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                   useDefaultWebProxy="true">
    </httpTransport>
  </binding>
</customBinding>

<services>
      <service behaviorConfiguration="TEST.BattleMountain.TestService"
        name="TEST.BattleMountain.TestService">
        <endpoint address="" behaviorConfiguration="TestMethod"
          binding="customBinding" bindingConfiguration="CustomWsHttpSoap11"
          name="TestMethod-v2-0_pttBinding" bindingNamespace="urn:test:services:201005"
          contract="ITestMethodV20_ptt" />
</service>

当我使用SOA清理器创建测试请求时,我得到了soap故障

在消息上指定的SOAP操作''与HTTP SOAP Action不匹配,'urn:test:services:201005:TestMethod-v2-0'。

我不确定为什么会这样。请求如下

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">urn:test:services:201005:TestMethod-v2-0</Action>
  </s:Header>
  <s:Body>
    <DistributionEnvelope xmlns="urn:test:ns:201005" />
  </s:Body>
</s:Envelope>

1 个答案:

答案 0 :(得分:0)

您发布的请求不是真正的请求。实际上没有肥皂动作发送(使用提琴手看)。所以客户端(soacleaner?)并没有真正发送动作。见here for details