Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use SAAJ to send MTOM messages

 
Javad Yarahmadi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looked like you're use Metro JAX-WS 2.x
Have you read the doc:
Section:
6. Handler
or
1. Extensions
 
Javad Yarahmadi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the doc? those 2 sections.
 
Javad Yarahmadi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul. I appreciate the reply. I take a look. I also found a way to attach headers using JAX-WS.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic