Java Reference
In-Depth Information
Configuring
a
Java
Web
Service
with
Reliable
Messaging
Problem
You have a web service endpoint, and you want it to guarantee delivery of messages.
Solution
As of this writing, there is no annotation to make your life easier, so you have to write it into
the WSDL. If you have been generating your WSDL, you can save it locally in your project
in the WEB-INF/wsdlfolder, point the service to the WSDL, and add the following code:
<definitions
xmlns:wsu="http://docs.oasis-open.org/wss/2004/
01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
...>
<wsp:UsingPolicy required="true" />
<wsp:Policy wsu:Id="MyPortBinding_ReliableMessaging_Policy">
<wsp:ExactlyOne>
<wsp:All>
<wsrm:RMAssertion>
<!-- 2.5 minutes -->
<wsrm:InactivityTimeout Milliseconds="150000"/>
<!-- Retry after 5 seconds unacknowledged -->
<wsrm:BaseRetransmissionInterval Milliseconds="5000" />
</wsrm:RMAssertion>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
//....
<binding name="MyPortBinding" type="tns:MyPort">
<wsaw:UsingAddressing required="true"/>
<wsp:PolicyReference URI="#MyPortBinding_ReliableMessaging_Policy"/>
Basically what you're doing here is adding the reliable messaging assertion to the policy in
the WSDL. You're defining a policy that you have to use reliable messaging in this particu-
Search WWH ::




Custom Search