Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

For example, to enable the WS-Policy Framework on the server side, you configuration file could look like this:

Code Block
xml
xml

<jaxws:endpoint ...>
    <jaxws:features>
        <p:policies/>
    </jaxws:features>
</jaxws:endpoint>

and your wsdl:

Code Block
xml
xml

<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
        <wsp:Policy/>
    </wsam:Addressing>
    <wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
        <wsrmp:BaseRetransmissionInterval Milliseconds="10000"/> 
    </wsrmp:RMAssertion>
</wsp:Policy>
...
<wsdl:service name="ReliableGreeterService">
    <wsdl:port binding="tns:GreeterSOAPBinding" name="GreeterPort">
        <soap:address location="http://localhost:9020/SoapContext/GreeterPort"/>
        <wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>        
    </wsdl:port>
</wsdl:service>

Instead of attaching the PolicyReference attached to the wsdl:port element, you can also specify it as a child element of the policies features, e.g. for the server endpoint:

Code Block
xml
xml

<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy" ...>
</wsp:Policy>

<jaxws:endpoint ...>
    <jaxws:features>
        <p:policies>
            <wsp:PolicyReference URI="#RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"/>
        </p:policies>
    </jaxws:features>
</jaxws:endpoint>

...

For details about the element types used in this namespace please refer to the schemas for the http://cxf.apache.org/ws/rm/manager namespace (http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd and http://cxf.apache.org/schemas/configuration/wsrm-manager-types.xsd). The jbdcStore element type is described below.

Example (feature applied at bus level):

Code Block
xml
xml

<cxf:bus>
    <cxf:features>
        <wsa:addressing/>
        <wsrm-mgr:reliableMessaging>
            <wsrm-policy:RMAssertion>
                <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>           
                <wsrm-policy:AcknowledgementInterval Milliseconds="2000"/>          
            </wsrm-policy:RMAssertion> 
            <wsrm-mgr:sourcePolicy>
                <wsrm-mgr:sequenceTerminationPolicy maxLength="5"/>                    
            </wsrm-mgr:sourcePolicy>     
            <wsrm-mgr:destinationPolicy acceptOffers="false">            
            <wsrm:store>
               <ref bean="myStore"/>
            </wsrm:store>
        </wsrm-mgr:reliableMessaging>
    </cxf:features>
</cxf:bus>

...

Attribute Name

Type

Default

dataSource

String

null

driverClassName

String

org.apache.derby.jdbc.EmbeddedDriver

initialReconnectDelay

long

0

keepConnection

boolean

false

maxReconnectAttempts

int

0

passWord

String

null

tableExistsCode

int

0

tableExistsState

String

null

schemaName

String

null

userName

String

null

url

String

jdbc:derby:rmdb;create=true

Example:

Code Block
xml
xml

<wsrm-mgr:jdbcStore xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager" id="myStore"
    driverClassName="org.apache.derby.jdbc.ClientDriver"
    url="jdbc:derby://localhost:1527/rmdb;create=true"
    password="password"/>

...

To ensure that the Reliable Messaging interceptors are added to the appropriate interceptor chains, e.g. for all client and server endpoints:

Code Block
xml
xml

<bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor">
    <property name="bus" ref="cxf"/>
</bean>
<bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor">
    <property name="bus" ref="cxf"/>
</bean>
<bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>

<cxf:bus ...>
    <cxf:inInterceptors>
        <ref bean="rmLogicalIn"/>
        <ref bean="rmCodec"/>
    </cxf:inInterceptors>
    <cxf:inFaultInterceptors>
        <ref bean="rmLogicalIn"/>
        <ref bean="rmCodec"/>
    </cxf:inFaultInterceptors>
    <cxf:outInterceptors>
        <ref bean="rmLogicalOut"/>
        <ref bean="rmCodec"/>
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
        <ref bean="rmLogicalOut"/>
        <ref bean="rmCodec"/>
    <cxf:outFaultInterceptors>
</cxf:bus>

...

To configure properties of the RM Manager, you can use the rmManager element from the http://cxf.apache.org/ws/rm/manager namespace. It supports the same child elements as the reliableMessaging feature element above. For example, without using features, you can determine that seuences should have a maximum length of 5 as follows:

Code Block
xml
xml

<wsrm-mgr:rmManager xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager">
    <wsrm-mgr:sourcePolicy>
        <wsrm-mgr:sequenceTerminationPolicy maxLength="5"/>                    
    </wsrm-mgr:sourcePolicy>
</wsrm-mgr:rmManager>