I am currently trying to consume a .NET webservice which uses ws-policy and
ws-addressing.
When trying to call the webservice I get a SOAPFaultException "None of the
policy alternatives can be satisfied". To narrow down the reason why it
fails I'm debugging into PolicyEngingeImpl.supportsAlternative, as someone
suggested elsewhere on this mailing list, and I can see that it fails on a
policy assertion named
"{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing".
I found an entry in the docs on how to use ws-addressing with ws-policy here
http://cxf.apache.org/docs/ws-addressing.html#WS-Addressing-EnablingWSAddres
singwithWSPolicy, which states
"If you're using WS-Policy, CXF can automatically set up WS-Addressing for
you if you use the <Addressing> policy expression. TODO"
Can somebody please explain what the "<Addressing> policy expression" is?
What information might be missing here due to the "TODO"?
Must ws-addressing be explicitly enabled or does it work out of the box?
Also, do I have to include special ws-addressing dependencies in maven
(which I haven't found in the repo)?
My service is currently defined like this:
<jaxws:client
id="..."
serviceClass="MyGeneratedWSDL2JavaInterface"
address="http://..."
wsdlLocation="http://..."
serviceName="kpsn:MyService"
<jaxws:properties>
<entry key="ws-security.encryption.properties"
value="encryption.properties" />
<entry key="ws-security.signature.properties"
value="signature.properties" />
<entry key="ws-security.encryption.username"
value="encryptionUser" />
<entry key="ws-security.callback-handler"
value="callbackHandler" />
</jaxws:properties>
<jaxws:features>
<wsa:addressing
xmlns:wsa="http://cxf.apache.org/ws/addressing" />
</jaxws:features>
</jaxws:client>
Here is an excerpt from the wsdl I am using:
<wsp:Policy wsu:Id="IMyService_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SymmetricBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Includ
eToken/Never">
<wsp:Policy>
<sp:RequireDerivedKeys />
<sp:RequireThumbprintReference />
<sp:WssX509V3Token10 />
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256
/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict
/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp />
<sp:EncryptSignature />
<sp:OnlySignEntireHeadersAndBody />
</wsp:Policy>
</sp:SymmetricBinding>
<sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Includ
eToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10 />
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss11
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier />
<sp:MustSupportRefIssuerSerial />
<sp:MustSupportRefThumbprint
/>
<sp:MustSupportRefEncryptedKey />
</wsp:Policy>
</sp:Wss11>
<sp:Trust10
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportIssuedTokens
/>
<sp:RequireClientEntropy />
<sp:RequireServerEntropy />
</wsp:Policy>
</sp:Trust10>
<wsaw:UsingAddressing />
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy
wsu:Id="IMyService_MyMethod_Input_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:SignedParts
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<sp:Header Name="To"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="From"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="FaultTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="ReplyTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="MessageID"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="RelatesTo"
Namespace="http://www.w3.org/2005/08/addressing" />
<sp:Header Name="Action"
Namespace="http://www.w3.org/2005/08/addressing" />
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
Thank you for helping!