2015-06-19 120 views
0

我有一個從STS獲取令牌的問題。如果我使用SoapUI,我會得到令牌。但我不知道如何配置它創建類似的請求,我的客戶端應用程序:爲WIF .NET 4.5配置WCF客戶端

<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://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue</a:Action> 
 
    <a:To s:mustUnderstand="1">https://.../idp/sts.wst</a:To> 
 
    <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> 
 
     <o:Username>xxxUSERxxx</o:Username> 
 
     <o:Password>xxxPWxxx</o:Password> 
 
     </o:UsernameToken> 
 
    </o:Security> 
 
    </s:Header> 
 
    <s:Body> 
 
    <trust:RequestSecurityToken Context="http://client.ws.com" xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512"> 
 
     <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> 
 
     <a:EndpointReference> 
 
      <a:Address>xxxADDRESSxxx</a:Address> 
 
     </a:EndpointReference> 
 
     </wsp:AppliesTo> 
 
     <trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType> 
 
     <trust:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</trust:RequestType> 
 
     <trust:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</trust:TokenType> 
 
    </trust:RequestSecurityToken> 
 
    </s:Body> 
 
</s:Envelope>

任何人可以幫助我嗎?

回答

0

STS是否公開元數據交換端點?如果是這樣,您可以通過Visual Studio的「添加服務引用」對話框(或僅使用svcutil)創建客戶端代理。

您可以使用this article作爲起點。