Can't get WS-RM to do ExactlyOnce + InOrder
karypid Aug 12, 2008 10:55 AMI am using this web service to test WS-RM:
@Stateless @WebService(serviceName = "MyRMTestService", portName = "MyRMTestSOAP", targetNamespace = "http://www.example.org/MyRMTest/", endpointInterface = "org.example.myrmtest.MyRMTest" ) @EndpointConfig( configFile = "META-INF/wsrm-jaxws-endpoint-config.xml", configName = "Standard WSRM Endpoint" ) @PolicyAttachment(@Policy( policyFileLocation = "META-INF/wsrm-exactly-once-in-order-policy.xml", scope = PolicyScopeLevel.WSDL_BINDING )) public class MyRMTestService { public String echo(String in) { System.out.println("RECEIVED: " + in); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("RETURNING from: " + in); return in; } }The policy file contains:
<?xml version="1.0" encoding="UTF-8"?> <wsp:Policy wsu:Id="exactly_one_in_order_rm_delivery" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsrmp:DeliveryAssurance> <wsp:Policy> <wsrmp:ExactlyOnce /> <wsrmp:InOrder /> </wsp:Policy> </wsrmp:DeliveryAssurance> </wsp:Policy>I was assuming that if I send out 5 messages using a simple client they should arrive exactly once and in order. Instead, using this client:
public void wsrmTest() throws Throwable { final int MAX_PACKETS = 5; try { QName serviceName = new QName("http://www.example.org/MyRMTest/", "MyRMTestService"); URL wsdlURL = new URL( "http://localhost:8080/myRMTest/MyRMTestService?wsdl"); MyRMTest_Service ss = new MyRMTest_Service(wsdlURL, serviceName); ssp = ss.getMyRMTestSOAP(); ((StubExt) ssp).setConfigName("Standard Anonymous WSRM Client", "META-INF/wsrm-jaxws-client-config.xml"); Response<EchoResponse> asyncResponse = null; for (int i = 0; i < MAX_PACKETS; i++) asyncResponse = ssp.echoAsync("ASYNC PACKET " + i); System.out .println("Last response: " + asyncResponse.get()); } catch (Throwable t) { t.printStackTrace(); throw t; } ((RMProvider) ssp).closeSequence(); }I get the following output:
17:53:14,426 INFO [STDOUT] RECEIVED: ASYNC PACKET 4 17:53:14,426 INFO [STDOUT] RECEIVED: ASYNC PACKET 2 17:53:14,426 INFO [STDOUT] RECEIVED: ASYNC PACKET 3 17:53:14,458 INFO [STDOUT] RECEIVED: ASYNC PACKET 1 17:53:14,458 INFO [STDOUT] RECEIVED: ASYNC PACKET 0 17:53:16,426 INFO [STDOUT] RETURNING from: ASYNC PACKET 4 17:53:16,426 INFO [STDOUT] RETURNING from: ASYNC PACKET 2 17:53:16,426 INFO [STDOUT] RETURNING from: ASYNC PACKET 3 17:53:16,457 INFO [STDOUT] RETURNING from: ASYNC PACKET 1 17:53:16,457 INFO [STDOUT] RETURNING from: ASYNC PACKET 0Is there something wrong with my policy file? Why do messages get delivered "out-of-order"?