Versions Compared

Key

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

...

Code Block
xml
xml
<jaxws:endpoint ...>
    <jaxws:features>
        <p:policies/>
    </jaxws:features>
</jaswsjaxws: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 having attaching the PolicyReference attached to a 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>

...

If you don't want to involve the WS-Policy Framework, or want to configure additional parameters such as the sequence termination policy or the persistent store, you can you can use the reliableMessaging feature. It is defined in namespace http://cxf.apache.org/ws/rm/manager and supports the following child elements:

Name

Value

RMAssertion

An element of type RMAssertion.

deliveryAssurance

An element of type DeliveryAssuranceType that describes the delivery assurance that should apply (AtMostOnce, AtLeastOnce, InOrder).

sourcePolicy

An element of type SourcePolicyType that allows you to configure details of the RM source, such as whether an offer should always be included in a CreateSequence request, or the sequence termination policy.

destinationPolicy

An element of type DestinationPolicyType that allows you to configure details of the RM destination, such as whether inbould inbound offers should be accepted.

store

The store to use (default: null). This must be an element of type jdbcStore (in the same namespace), or a bean or a reference to a bean that implements the RMStore interface.

...

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>

Configuring the Reliable Messaging Store

To enable persistence, you must specify the object implementing the persistent store for RM. You can develop your own, or use the JDBC based store that comes with CXF (class org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore). You can configure the latter using a custom jdbcStore bean (namespace http://cxf.apache.org/ws/rm/manager). It supports the attributes:

...

Code Block
xml
xml
<wsrm-mgr:jdbStore id="myStore"
    driverClassName="org.apache.derby.jdbc.ClientDriver"/>
    url="jdbc:derby://localhost:1527/rmdb;create=true"/>
    password="password"/>

Adding the Reliable Messaging Interceptors Manually

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

...

The RetransmissionIntercepor will be added on the fly by the RMOutInterceptor so need not appear in your configuration file.

Configuring the Reliable Messaging Manager Manually

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>

...

code