尝试在 Visual Studio 2010 中添加对 Web 服务的引用时出现错误。Web 服务是使用 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 无法导入断言?
PS 我能够使用 SoapUI 工具导入和测试 Web 服务。