2010-04-02 40 views
1

我想配置WCF客戶端能夠消耗返回下面的響應消息的Web服務:如何配置自定義綁定以使用WCF使用此WS安全Web服務?

響應消息

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://myservice.wsdl"> 
    <env:Header> 
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1" /> 
    </env:Header> 
    <env:Body> 
    <ns0:StatusResponse> 
     <result> 
     ... 
     </result> 
    </ns0:StatusResponse> 
    </env:Body> 
</env:Envelope> 

要做到這一點,我已經構建自定義綁定(這不起作用)。我不斷收到「安全頭是空的」消息。

我的綁定:

<customBinding> 
    <binding name="myCustomBindingForVestaServices"> 
     <security authenticationMode="UserNameOverTransport" 
      messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11" 
      securityHeaderLayout="Strict" 
      includeTimestamp="false" 
      requireDerivedKeys="true"> 
     </security> 
     <textMessageEncoding messageVersion="Soap11" /> 
     <httpsTransport authenticationScheme="Negotiate" requireClientCertificate ="false" realm =""/> 
    </binding> 
    </customBinding> 

我的要求似乎是使用相同的SOAP和WS安全版本作爲響應,但使用不同的命名空間前綴(「O」,而不是「WSSE」)。這可能是我不斷收到「安全標題爲空」消息的原因嗎?

請求消息

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
    <s:Header> 
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <o:UsernameToken u:Id="uuid-d3b70d1f-0ebb-4a79-85e6-34f0d6aa3d0f-1"> 
     <o:Username>user</o:Username> 
     <o:Password>pass</o:Password> 
     </o:UsernameToken> 
    </o:Security> 
    </s:Header> 
    <s:Body> 
    <getPrdStatus xmlns="http://myservice.wsdl"> 
     <request xmlns="" xmlns:a="http://myservice.wsdl" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
     ... 
     </request> 
    </getPrdStatus> 
    </s:Body> 
</s:Envelope> 

如何,我需要配置我的WCF客戶端綁定到能夠消耗該web服務?

任何幫助非常感謝!

桑德

+0

仍然沒有運氣。一些額外的信息:我正在使用OC4J Web服務。 WSE可以很好地使用這項服務。 SOAPUI也是(ws-security,passwordtext)。 – Soeteman 2010-04-06 15:46:02

回答

相關問題