2011-02-06 38 views
2

试图引用在Visual Studio 2010中的Web服务使用JAX-WS /地铁/ GlassFish的堆栈用Java实现,包含添加到Web服务时收到错误一个UsernameToken策略。下面是从WSDL的摘录:Visual Studio中不能使用Web服务包含的UsernameToken政策

<wsp:Policy 
     xmlns:wsp="http://www.w3.org/ns/ws-policy" 
     xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" 
     wsu:Id="UsernameToken"> 
    <sp:SupportingTokens> 
     <wsp:Policy> 
      <sp:UsernameToken sp:IncludeToken=".../IncludeToken/AlwaysToRecipient" /> 
     </wsp:Policy> 
    </sp:SupportingTokens> 
</wsp:Policy> 

当我尝试将服务引用添加到Visual Studio的这个Web服务,我得到以下警告:

Custom tool warning: 
    The following Policy Assertions were not Imported: 
    XPath://wsdl:definitions[@targetNamespace='http://archfirst.org/bfoms/tradingservice.wsdl']/wsdl:binding[@name='TradingWebServicePortBinding'] 
    Assertions: 
    <sp:SupportingTokens xmlns:sp='http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'>..</sp:SupportingTokens> 

Custom tool warning: 
    Endpoint 'TradingWebServicePort' at address 'http://localhost:8080/bfoms-javaee/TradingService' 
    is not compatible with Silverlight 4. Skipping... 

Custom tool warning: 
    No endpoints compatible with Silverlight 4 were found. The generated client 
    class will not be usable unless endpoint information is provided via the 
    constructor. 

为什么Visual Studio中不能导入断言?

P.S.我能够使用SoapUI工具导入和测试Web服务。

回答

3

WCF默认只支持超过安全运输= HTTPS(或与由证书,但message security is not supported受Silverlight在所有提供的消息的安全性)的用户名令牌。 There is a way建立自定义绑定,允许用户名令牌通过不安全的交通,但allowInsecureTransportis probably not supported通过Silverlight 4的(我还没有创建自定义绑定时找到它)。

WCF也不支持与消化密码的用户名令牌。如果您需要使用WCF安全管道的消解密码you have to implement additional part的用户名令牌。再次,它可能是有限的Silverlight功能集的问题。

您可以尝试在您的托管应用程序中创建代理服务。此服务将由Silverlight应用程序调用,它将调用Java服务。

+0

谢谢拉迪斯拉夫。由于我可以控制服务器,因此可以将其更改为我想要的任何内容。什么是Silverlight客户端支持的最简单的基于WS-I的身份验证机制?我在Java方面的唯一要求是验证主叫用户并确定他们的用户名。如果你也可以参考我的链接来解释如何在Silverlight端进行设置,那将是非常好的。谢谢。 – Naresh 2011-02-06 14:14:22

相关问题