aspose file tools*
The moose likes Web Services and the fly likes MTOM not working in Axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "MTOM not working in Axis2" Watch "MTOM not working in Axis2" New topic
Author

MTOM not working in Axis2

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I am trying to transfer content using MTOM (in Axis2). For this I have added the following entry to services.xml



In the client, I am doing the following



In the service, I am doing the following



The content transfers fine, but when I access the SOAP response, it shows the following



It seems that MTOM setting is not having any effect.
Pleae let me know if I am missing something in order to enable MTOM.

Thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
I have noticed your wsdl which says


So if you have given content type as base64Binary then you should be getting base64 encoded data and you are getting that. I don't see any problem.


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

Joined: Jun 29, 2005
Posts: 279
Is still MTOM getting used?
Actually we will be transferring huge files (50-100MB) using this service. So need to use MTOM for content transfer.

I have read that transferring binary data as payload increases the size three times. So don't want to do that.

Thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
You are correct it seems like mtom is not engaged. Can you post your code (service/client) where you are trying to enable mtom?
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
I tried it my self and got MTOM enabled at server side. Here is my service skeleton code.


and service.xml


Options I used to generate skeleton


SOAP response


Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Can't find it any different from what I have done.
Can you please post the client as well?

thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
I used soap UI. To figure out if problem is with client, use soap UI with your service. But my presumption is problem should not be in client side.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Tried with soapUI but with the same result.
Also, set the property

<parameter name="enableMTOM">true</parameter>

in axis2.xml in the Service.
Earlier it was there in services.xml only.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Have you restarted your server after making changes to parameter in services.xml?
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Yes, I restarted the server.

MTOM example that you tried was it contract first or code first? It seems code first MTOM is working but when using contract first approach, MTOM classes are not getting generated by the eclipse plugin or WSDL2Java
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
It's contact first. Can you post your generated response object code? I am interested to see following method
.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
shivendra tripathi wrote:It's contact first. Can you post your generated response object code? I am interested to see following method
.


Thanks for replyng.

Here is the setContent method



and here is the complete class


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MTOM not working in Axis2
 
Similar Threads
Axis2 - Transfer document using MTOM
Axis2 - Transfer document using MTOM
Axis2, client handler not getting called
Axis2 - Handlers for SOAP headers
MTOM content transfer - Axis2