尝试在Visual Studio 2010中添加对Web Service的引用时出现错误.Web Service使用JAX-WS / Metro / GlassFish堆栈以Java实现,并包含UsernameToken策略。以下是WSDL的摘录:
<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服务。
答案 0 :(得分:3)
默认情况下,WCF仅支持基于安全传输的用户名令牌= HTTPS(或者由证书提供消息安全性,但Silverlight根据message security is not supported提供)。 There is a way构建自定义绑定以允许用户名称令牌通过不安全的传输,但{4}} is probably not supported由Silverlight 4构建(我在创建自定义绑定时也没有找到它)。
WCF也不支持使用已消化密码的用户名令牌。如果您需要带有WCF安全管道的消化密码you have to implement additional part的用户名令牌。同样,它可能是Silverlight有限功能集的问题。
您可以尝试在托管应用程序中创建代理服务。该服务将由Silverlight应用程序调用,它将调用Java服务。