如何在我尝试为SOAP Web服务创建的wsp:Policy
文档中添加安全策略wsdl
?
<wsp:Policy wsu:Id="UserNameWSTrustBinding_IWSTrust13Async_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>...</wsp:Policy>
</sp:TransportBinding>
<sp:SignedEncryptedSupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>...</wsp:Policy>
</sp:SignedEncryptedSupportingTokens>
<sp:EndorsingSupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
<wsp:Policy>...</wsp:Policy>
</sp:EndorsingSupportingTokens>
<sp:Wss11 xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">...</sp:Wss11>
<sp:Trust13 xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">...</sp:Trust13>
<wsaw:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
我正在使用JAX-WS和Spring来构建SOAP Web服务。服务的一部分也是通过使用WSDL4J
API编写WSDL定义来提供我正在构建的元数据。如下所示:
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
Definition definition = wsdlFactory.newDefinition();
// Namespaces
setNamespaces(definition);
// Policy
setPolicy(definition);
// Messages - Input
setInputMessageForWSDLDefinition(definition);
// Messages - Output
setOutputMessageForWSDLDefinition(definition);
// PortType
setPortTypeForWSDLDefinition(definition);
// Binding
setBindingForWSDLDefinition(definition);
// Service
setServiceForWSDLDefinition(definition, singleSignOnService);
答案 0 :(得分:0)
这是我向wsdl添加政策的方式
@Policies(
{ @Policy(uri = "classpath:SecurityPolicy.xml") })
apache-cxf
提供此功能以向wsdl