Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Attachment with WSDL2Java objects

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This concerns adding file attachments to a Axis-based, SOAP-based web service.

Is it possible to add file attachments using the objects created by the Axis WSDL2Java program?
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can very well do that in axis. All you have to do is have element of type base64binary in request envelope and that can be used to contain your attachment. If you data transfer in optimized way you can used MTOM supported by axis2.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'm not asking if this can be done with Axis. I'm asking if it can be done with the objects created from the WSDL2Java program.

If I run WSDL2Java on a WSDL file, I will get a group of class files. Can you add an attachment with these classes?

How would you add the Attachment part with the {XXX}SoapBindingImpl object?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to programatically add the attachments to the response MessageContext.

The client gets to the response MessageContext from the OperationContext from the request MessageContext.

The binary data of the attachment is not included in the SOAP Envelope and is not parsed.
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So now you can change your opinion that it cannot be added in response and same thing I am saying from long back.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lol, it certainly should NOT be done the way you suggested. And it is not possible in the manner stated earlier via binding object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic