29. Server Side Asynchrony Request <soap:Envelope> <soap:Header> <wsa:MessageID>uuid:35f19ca8-c9fe</wsa:MessageID> <wsa:Action>http://lh:80/request/…</wsa:Action> <wsa:ReplyTo> <wsa:Address>http://lh:77/response</wsa:Address> <wsa:ReferenceParameters> <customHeader>correlationKey</customHeader> </wsa:ReferenceParameters> </wsa:ReplyTo> <wsa:To>http://lh:80/request</wsa:To> </soap:Header> <soap:Body>…</soap:Body> </soap:Envelope>
30. Server Side Asynchrony Response <soap:Envelope> <soap:Header> <wsa:To>http://lh:77/response</wsa:To> <wsa:Action>urn:response</wsa:Action> <wsa:MessageID>uuid:cb383139-cdf2</wsa:MessageID> <wsa:RelatesTo>uuid:35f19ca8-c9fe</wsa:RelatesTo> <customHeader wsa:IsReferenceParameter=“1”> correlationKey</customHeader> </soap:Header> <soap:Body>…</soap:Body> </soap:Envelope>
31.
32.
33.
34. Server Side Asynchrony Client side invocation StockQuote sq = service.getStockQuote(); // Populate headers AddressingVersion av = AddressingVersion.W3C; WSBindingProvider wsbp = (WSBindingProvider)sq; WSEndpointReference replyTo = new WSEndpointReference( “ http://lh:77/response ” , av ); String uuid = “uuid:” + UUID.randomUUID(); wsbp.setOutboundHeaders( new StringHeader(av.messageIDTag, uuid), new StringHeader(av.toTag,”http://lh:88/…”), replyTo.createHeader(av.replyToTag); sq.getPrice(“ORCL”);
35. Server Side Asynchrony Callback Implementation // Deal with response @Resource WebServiceContext wsContext; public void getPriceResponse(String _return) { HeaderList hl = wsContext.getMessageContext().get( JAXWSPRopertiers.INBOUND_HEADER_LIST_PROPERTY); Header h = hl.get(AddressingVersion.W3C.relatesToTag()); String relatesToMessageId = h.getStringContents(); … } // How about receiving a fault?
For the BPEL entry we should not: <10’s seconds synchronous Asynchronous services >minutes then use BPEL
Note that this style is become more populate in web browser, for example the built in database in HTML 5 uses this form; but it can be harder to write code that works in this way because you need to make sure the main focus of the tool you are working on is ready.
Can’t use AddressingFeature as once you have created any headers it wont work anymore – really annoying. Hence this longer code above. Could be using handlers but they are more painful when you need to set and extract instance information. Easier to put the code in-line
Annoyed this fix go pulled from Farralon as pyoung didn’t think it was important. I guess we just skirt the issue, or offer a dirty fat patch.
I supose the point to be made here is that The Async Reponder needs to be managed in some way….. Hence we are using JMS…..