使用SoapUI测试WCF服务时SOAP Action不匹配错误

Sen*_*asu 15 wcf soapui

我正在使用SOAPUI中的示例输入测试WCF服务.当我点击运行时,我得到如下的SOAP异常:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
     <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/fault</a:Action>
   </s:Header>
<s:Body>
 <s:Fault>
     <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
           <s:Value>a:ActionMismatch</s:Value>
        </s:Subcode>
     </s:Code>
     <s:Reason>
        <s:Text xml:lang="en-US">The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'http://XXX.XX.XXXX/IXXXXXX/AddOrderInfromation'.</s:Text>
     </s:Reason>
     <s:Detail>
        <a:ProblemHeaderQName>a:Action</a:ProblemHeaderQName>
     </s:Detail>
  </s:Fault>
 </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

在博客中,他们要求添加Soap Action.如何在我的请求中添加Soap Action:

 <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wkus="http://XXX.XX.XXXX/IXXXXXX">
  <soap:Header />
  <soap:Body>
  <ns1:AddOrderInfromation>
     <!--Optional:-->
     <ns1:inputsting>
<ns1:AddOrderInfromation>
  <ns1:OrderNo>4500146</ns1:OrderNo>
  <ns1:OrderDate>08/22/2014</ns1:OrderDate>
  <ns1:TotalItems>1</ns1:TotalItems>         
</ns1:AddOrderInfromation>
 </ns1:inputsting>
 </ns1:AddOrderInfromation>
Run Code Online (Sandbox Code Playgroud)

请建议.提前致谢

Ram*_*sey 23

这可能是WS-A寻址问题.

在Request的WS-A选项卡中,选中"Enable WS-A addressing".您可能还需要选中"添加默认值为:到".


alb*_*iff 6

您的Web服务正在返回一个SOAPFault,它表示Web服务需要SOAP Action http标头.为了在SOAPUI的SOAP请求中添加SOAP操作,您必须添加一个名为的http头SOAPAction,这样做是为了执行下一步:

  • 在SOAP测试请求的底部有一些选项卡(Header(0),Attachments(0)...),打开选项卡.Header(0)然后使用+添加按钮,添加一个带有SOAPAction名称和值的标题:

在此输入图像描述

希望这可以帮助,


小智 5

我也遇到了这个问题,并通过在 SopaUI 中启用 WS-A 寻址来解决它。 SoapUI 截图