Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let look into them in details.

WSDL Policy attachment

WS-Policies can be attached and referenced in WSDL elements. Web Services Policy 1.5 - Attachment standard describes all possible alternatives. WS-Policies can be placed inside WSDL itself or referenced as external documents. CXF will automatically recognize, read and use policies defined or referenced in WSDL. Sample of attached policy is shown below:

Code Block
xml
xml
<wsdl:definitions name="HelloWorld" targetNamespace="http://apache.org/hello_world_soap_http" 
…
<wsdl:service name="SOAPService">
    <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
        <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
        <wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy">
             <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
                 <wsp:Policy/>
              </wsam:Addressing>
         </wsp:Policy>
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

Spring configuration

It is possible to define policies directly in Spring configuration of client and service as jaxws feature. CFX will recognize and use configured WS-Policies:
Client:

...

Code Block
xml
xml
<jaxws:endpoint id="CRMService"
        xmlns:serviceNamespace="http://services.talend.org/CRMService"
        serviceName="serviceNamespace:CRMServiceProvider"
        endpointName="serviceNamespace:CRMServicePort"
        implementor="#CRMServiceBean"
        address="/CRMServiceProvider">
        <jaxws:features>
            <p:policies>
                <wsp:PolicyReference URI="classpath:/saml.policy"/>
            </p:policies>
        </jaxws:features>
</jaxws:endpoint>

Dynamically via message property

Sometimes policies cannot be configured statically, because they are obtained or calculated dynamically for concrete message (for example using Policy Server or Service Registry). For such cases CXF provide a possibility to load policy dynamically and set it into the message context property. It can be done for example in custom interceptor that fulfils the following:

...