Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem sending a DataHandler MTOM on Axis2 web service (ArrayIndexOutOfBoundsException)  RSS feed

 
Giuseppe Tino
Greenhorn
Posts: 10
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
as I told in subject I've a problem sending a file to a web service deployed on axis2.
I catched the soap message sent from the client to the server via tcp mon, it seems correct:



As you can see the file (a simple csv file) is correctly attached to the soap message and is comprehensible (not codified).
The web service is the following:



When I send the SOAP message to the web service I've the following exception


I'm sure that the problem is due to the 4th parameter that is a DataHandler because if I change the web service interface (putting OMElement in place of DataHandler) like the following code:


I don't receive the exception and on the console I have:

Admin
pass
MjAxMTA0MTIwODAzMDY7OTguODk1MjtOT0xBIERJUiBTVUQ7TWFyY2lhDQoyMDExMDQxMjA4MDk1ODs5Ny42MjU5O1BBTE1BIENBTVBBTklBIERJUiBTVUQ7TWFyY2lhDQoyMDExMDQxMj.....


So the web service method has been correctly called. Also the parameter loginName and password are correctly sent (the first two line on the console). But the OMElement doesn't contain the string that I can see in the soap message (that is the correct file) but the strange string reported in the third line of the console.
Could be this the problem? How can I solve it?
I have not write the code of the client here for simplicity, because I think that the SOAP Message and the web serivice are sufficient. If the client code is needed please ask me.
Thanks in advance
 
Giuseppe Tino
Greenhorn
Posts: 10
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok an update/resume about my issue.

I'm trying to send a text/csv file from a Java application to a Web Service Deployed on Axis 2.
To send the file I use a DataHandler:

and pass the DataHandler as parameter.
When I see the SOAP message generated by client I see that the field containing the file has the file content codified base64:
MjAxMTA0MTIwODAzMDY7OTguODk1MjtOT0xBIERJUiBTVUQ7TWFyY2lhDQoyMDExMDQxMjA4MDk1ODs5Ny42MjU5O1BBTE1BIENBTVBBT....

Is it normal? A DataHandler codifies the file content base64?
If I enable the MTOM on the client:

when I see the SOAP message sent by client to web service I can see the file correctly attached externally, but in this case I can read the csv text because the file is not codified Base64.
Why in this case the file is not codified? Is there an option that tell to the client to not codify the file?
Is the behavior described correct? Shouldn't it be the opposite?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!