File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Client for MTOM content transfer in Axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Client for MTOM content transfer in Axis2" Watch "Client for MTOM content transfer in Axis2" New topic
Author

Client for MTOM content transfer in Axis2

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I have a webservice in Axis2 from which I need to download content (pdf files).

I have written the following for the client ( from http://ws.apache.org/axis2/1_5_1/mtom-guide.html)



but I am getting these error

1. The method setOptions(Options) is undefined for the type ResumeClient

2. Constants cannot be resolved

I checked the class "org.apache.axis2.Constants.Configuration" but "FORCE_MIME" was not a field there.

Please let me know which class to import and how to set the options.

Thank you


shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Regarding 1 > Does ResumeClient extends ServiceClient
Regarding 2> You are right FORCE_MIME doesn't exist. But this will be applicable by default if MTOM is enabled. User guide needs to be updated.


SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
shivendra tripathi wrote: Does ResumeClient extends ServiceClient


No, it doesn't. Should clients extend ServiceClient?
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I changed the method to



Is this the right way of doing it? In this I have no where specified where to save the document...
Thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
If depends on the service the way it sends attachment. If it send as SWA/MTOM then you have to get hold of envelope and fetch it. But if it is simple mime/multipart then you have to take attachment part out from the response.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
shivendra tripathi wrote:If depends on the service the way it sends attachment. If it send as SWA/MTOM then you have to get hold of envelope and fetch it. But if it is simple mime/multipart then you have to take attachment part out from the response.


I intend to use MTOM. So what is the correct way in that case?

Thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
You need to get hold of soap envelope where it will be having reference to attachment. You can get soap envelope from MessageContext, there can be some MTOM specific API to get hold on attachment which I am not aware.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client for MTOM content transfer in Axis2