2015-06-19 37 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作为起点。