permaculture playing cards*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes WS-Address working example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "WS-Address working example" Watch "WS-Address working example" New topic
Author

WS-Address working example

khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
Hi,
I am not clear how we can use ws-address? I searched on line and gone through number of books but couldn't find a single example that shows how to create a soap message with ws-address and the server response back to the replyTo address.
Can any one give a complete example on this?
Thanks in advance
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1167
Web Services Addressing (WS-Addressing) shows examples. One is -





William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Bob Nedwor
hangman
Ranch Hand

Joined: Aug 17, 2005
Posts: 215

Thanks, that is great, Dan!

Can you show us the related WSDL? Or at least the portType and binding sections of it?

Bob N
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
Bob Nedwor
hangman
Ranch Hand

Joined: Aug 17, 2005
Posts: 215

I was able to get it to work, but it was more than a couple tweaks to the WSDL. To get my request side SOAP message (inbound to the service) to look like this, I needed to hack up my client quite a bit, including casting my service to a BindingProvider, create a SOAPHandler and mess around with the SOAPHeader, SOAPEnvelope, etc. Is there a faster way to build WS-Addressing into your client side that you know of off hand? Thanks for your advice.

Bob Nedwor
hangman
Ranch Hand

Joined: Aug 17, 2005
Posts: 215

After looking at this more closely, it seems that there are two ways to do this without having to create a BindingProvider, manually messing with SOAP elements, etc, like I mentioned in my previous post. But neither one results the namespace being defined in the header of the Envelope like in Dan's 03/29/2011 11:02:32 AM example above. Instead the namespace is defined within the individual elements. Also, neither one results in a MessageID element being created - just "To" and "Action."

a) On your server-side implementation class, use this annotation:
@com.sun.xml.ws.developer.MemberSubmissionAddressing(enabled=true, required=true)
and in your client code, pass an instance of
com.sun.xml.ws.developer.MemberSubmissionAddressingFeature(true, true)
into your getXXXXXport() method.

b) On your server-side implementation class, use this annotation:
@javax.xml.ws.soap.Addressing(enabled=true, required=true)
and in your client code, pass an instance of
javax.xml.ws.soap.AddressingFeature(true, true)
into your getXXXXXport() method.

One difference between a) and b) is that in order to compile the classes in option a) you need to add to your classpath a jar from either your jaxws-ri or glassfish apps whereas in option b) you do not (if you are on JDK 6).

The other big difference is that in option a), your "To" and "Action" elements in your SOAP header are using the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace where as in
option b), they are using the http://www.w3.org/2005/08/addressing namespace which seems to be more recent.

I am not sure which option a) or b) above is considered more "WS-Addressing Compliant," but I suspect that I am still missing something and I would appreciate advice as to how to get the MessageId element in along with the other two, and get my namespace defined once up in the header of the Envelope and still not have to create a BindingProvider, etc, like I mentioned in my previous post. One further note is that I did not tweak my WSDL, in either option, and it has no WS-Addressing-related items in it.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WS-Address working example
 
Similar Threads
Readonly Web services
WS-Address example
hard to under how ws-addressing is used.
JAX-WS - How to-
doubt in JAX-WS client implementation