Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

WS Addressing in WebSphere 5.1  RSS feed

 
anubechara Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALl
I need to call DOT.net Webservice which is using WS-addressing as a result of that I have to insert WS-Addressing tags such as <wsa:Action>,<wsa:MessageID>, <wsa:ReplyTo> and <wsa:To> in my soap request.I shall be grateful if anyone can guide me about how to insert these tags in outbound soap message. Is there any api which I can use to achieve this? If possible please provide some sample code and api links. I am really in need of help due to tight deadlines.

I am using RAD6.0 along with WebSphere 5.1.

Many thanks in advance
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Support for WS-Addressing didn't start until Version 6.
WebSphere Version 6 Web Services Handbook Development and Deployment (PDF)

For Version 5.1 there was ETTK 1.2 (Emerging Technologies Toolkit) that claims to support WS-Addressing however it may be difficult to locate
WebSphere Version 5.1 Application Developer 5.1.1 Web Services Handbook.

Your other option is to employ a third party web services stack that supports WS-Addressing for your client side processing.
Understanding WS-Addressing in Apache Axis2
However getting the libraries of another web services stack to run under WebSphere could pose a challenge (i.e. don't expect things to go smoothly).

The most laborious option would be to build simple .NET client and then capture typical request/response pairs between the client and the server with Apache TCPMon (Tutorial) or java.net tcpmon (the WSDL should tell you this but sometimes it is better to see the real thing). Then build a Java client capable of creating those same SOAP requests and processing the SOAP responses with SAAJ.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by anubechara Gupta:
Insert WS-Addressing tags such as <wsa:Action>,<wsa:MessageID>, <wsa:ReplyTo> and <wsa:To> in my soap request.


Probably the first thing you should try is to insert the necessary elements in a JAX-RPC handler in the client's outgoing handler chain. You still have to modify the SOAP message with SAAJ.

This example shows a client side handler adding a SOAP header to the SOAP request.

Support for J2EE Web Services in WebSphere Studio Application Developer V5.1 -- Part 3: JAX-RPC Handlers

Process attachments using JAX-RPC handlers

Access SOAPMessageContext from the service consumer
On the service consumer side, there is also no direct way to access SOAPMessageContext. The only way of doing this is by setting or getting properties on the javax.xml.rpc.Stub interface, defined as part of the JAX RPC standard. Every port implementation class (Listing 2) generated by Application Developer can be type-casted to the Stub interface, thus allowing for setting and getting Stub's properties.


Theoretically you should be able to call the javax.xml.rpc.Stub setProperty method on your Port object with your wsaAction, wsaMessageID, wsaReplyTo and wsaTo String values (or even javax.xml.rpc.holders.StringHolder) before you call the web method on the port (i.e. single thread only). The stub properties are copied to the SOAPMessageContext where the handler can retrieve the values and create the elements in the outgoing request as necessary.

The advantage of the StringHolder is that holder value changes (via the value field) by the handler (example: you extract header values in handleResponse) are available after the web method returns. With simple Strings this would not work as the SOAPMessageContext properties are not copied back to the Stub after the incoming handler chain is finished. Using a single Hashmap as a property for multiple name/value pairs would have the same effect.

How to create a simple JAX-RPC handler
[ November 18, 2008: Message edited by: Peer Reynders ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!