WCF客户端通过mustunderstand = 1

时间:2019-03-05 15:18:54

标签: wcf

您好,我正在尝试匹配我们的wcf服务以能够接受客户请求。我不是要使用服务。我正在尝试匹配我的服务,以便能够接受来自第三方的客户请求。

客户发送的肥皂请求。     

 <SOAP-ENV:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
     <wsse:UsernameToken>
      <wsse:Username>*****</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">***** </wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ImgSrch xmlns="http://jPG/2008">
     </ImgSrch>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

服务绑定应该是什么,以匹配来自客户端的请求。这就是我正在使用的。

<basicHttpBinding>   
  <binding name="httpsCertificateBinding" 
closeTimeout="01:01:00"  openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00"  />    
<security mode="TransportWithMessageCredential">    
    <message clientCredentialType="UserName"/>     
   <transport clientCredentialType="None"></transport>   
 </security>      
</binding>


 <serviceBehaviors>
     <behavior name="DefaultBehavior">
        <serviceMetadata httpGetEnabled="true"  />
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
<serviceCredentials>
       <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="CustomMembershipProvider"/>
 </serviceCredentials>
    <useRequestHeadersForMetadataAddress />
      </behavior>

        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>

对于上述请求和绑定组合,wcf服务引发一个异常,即它不能理解必须理解标头。

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body>
          <s:Fault>
             <faultcode>s:MustUnderstand</faultcode>
             <faultstring xml:lang="en-US">The header 'Security' from the namespace 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' was not understood by the recipient of this message, causing the message to not be processed.  This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process.  Please ensure that the configuration of the client's binding is consistent with the service's binding.</faultstring>
          </s:Fault>
       </s:Body>
    </s:Envelope>

谢谢您的帮助。

0 个答案:

没有答案