*
The moose likes Web Services and the fly likes File Attachment with WSDL2Java objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "File Attachment with WSDL2Java objects" Watch "File Attachment with WSDL2Java objects" New topic
Author

File Attachment with WSDL2Java objects

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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

Joined: Aug 26, 2008
Posts: 263
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.


SCJP 1.5(97%) My Blog
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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

Joined: Apr 16, 2008
Posts: 2187
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

Joined: Aug 26, 2008
Posts: 263
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

Joined: Apr 16, 2008
Posts: 2187
lol, it certainly should NOT be done the way you suggested. And it is not possible in the manner stated earlier via binding object.
 
 
subject: File Attachment with WSDL2Java objects
 
Similar Threads
Adding attachments to web service response
WSDL2Java Axis: [axis-wsdl2java] java.net.ConnectException: Connection timed out: con
wsdl2java that work with Oracle10g ??
Does AXIS 1.4 support SOAP 1.2
Passing binary files in webservices