wood burning stoves 2.0*
The moose likes Web Services and the fly likes How to use SAAJ to send MTOM messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to use SAAJ to send MTOM messages" Watch "How to use SAAJ to send MTOM messages" New topic
Author

How to use SAAJ to send MTOM messages

Javad Yarahmadi
Greenhorn

Joined: Apr 17, 2013
Posts: 5
Hi, I need to write a Java client for a web service that uses MTOM To upload attachments. I am required to use SAAJ to create the Soap request in the Java client but I am not sure how to do that. It is easy to use the JAX-WS generated classes to create a Java client but I need to add Soap headers to the message and with the generated classes I can't find a way to add the header to the Soap request. This code may help to clarify:


In above code, I can't add the Soap header to the soapRequest. But with Saaj, I can add the header without any issue but I think it would be different to send MTOM attachments with SAAJ and it may require special annotation or coding. Could you please let me know how to use SAAJ with MTOM? I need to know this as my time to implement this client is running out quickly. I appreciate your input.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
Looked like you're use Metro JAX-WS 2.x
Have you read the doc:
Section:
6. Handler
or
1. Extensions
Javad Yarahmadi
Greenhorn

Joined: Apr 17, 2013
Posts: 5
Thanks Paul. The handler is not an option because I need to access the dynamic data in the client and add them to the header. The Extensions on the other hand I am not sure of. Do you mean Spring extensions to JAX-WS? Thanks for your reply.
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
Have you read the doc? those 2 sections.
Javad Yarahmadi
Greenhorn

Joined: Apr 17, 2013
Posts: 5
Paul, I am not sure which doc we are referring to. Could you please send me a link? I appreciate it. Thanks!
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
You posted a section of code. And you do not know where it came from?
Every soapful implementation of JAX-WS 2.x has documentation that comes with it.
The code you posted use Metro RI implementation. Now go to Metro web site
and down load the API and/or read the doc online.

It has the doc and examples that I mentioned earlier. See posted Today 1:38:12 PM

Good luck.
Javad Yarahmadi
Greenhorn

Joined: Apr 17, 2013
Posts: 5
Thanks Paul. I appreciate the reply. I take a look. I also found a way to attach headers using JAX-WS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use SAAJ to send MTOM messages
 
Similar Threads
Sample Questions for 288 - Need answers
Testing clients of ws-secured web service
sending pdf or any attachment from a java webservice to java client using JAX-WS and SAAJ
MTOM example
How to use java to invoke an external webservices (soap, soap1.2)?