web services - Axis2 ArrayIndexOutOfBoundsException when I send a DataHandler -


i've problem when try send file (datahandler) web service deployed under axis2.

this client code (only part regarding web service call):

datahandler dh = new datahandler(new filedatasource("file")); appstub servicestub = new appstub("http://localhost:3333/axis2/services/myapp"); serviceclient serviceclient = servicestub._getserviceclient(); options options = new options(); options.setto(new endpointreference("http://localhost:3333/axis2/services/myapp")); options.setproperty(constants.configuration.enable_mtom, constants.value_true); serviceclient.setoptions(options); servicestub._setserviceclient(serviceclient); appstub.sendfiledata req = new appstub.sendfiledata (); req.setid(clientid); req.setloginname(loginname); req.setpassword(password); req.setfile(dh); appstub.sendfiledataresponse res = servicestub.setueldata(req); 

this soap message client send (intercepted via tcp mon):

post /axis2/services/myapp http/1.1 content-type: multipart/related; boundary="mimeboundary_7129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9"; type="application/xop+xml"; start="<0.4129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9@apache.org>"; start-info="text/xml" soapaction: "urn:sendfiledata" user-agent: axis2 host: 127.0.0.1:3333 transfer-encoding: chunked  649 --mimeboundary_7129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9 content-type: application/xop+xml; charset=utf-8; type="text/xml" content-transfer-encoding: binary content-id: <0.4129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9@apache.org>    <?xml version='1.0' encoding='utf-8'?>       <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">          <soapenv:body>             <ns3:sendfiledata xmlns:ns3="http://myapp">                <ns3:id>12</ns3:id>                <ns3:loginname>admin</ns3:loginname>                <ns3:password>pass</ns3:password>                <ns3:file>                   <xop:include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:1.5129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9@apache.org" />                </ns3:file>             </ns3:sendfiledata >          </soapenv:body>       </soapenv:envelope>--mimeboundary_7129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9content-type: application/octet-streamcontent-transfer-encoding: binarycontent-id:        <1.5129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9@apache.org>20110412080306;98.8952;nola dir sud;marcia20110412080958;97.6259;palma campania dir sud;marcia20110412081306;101.7761;sarno dir sud;marcia20110412081530;97.9944;nocera pagani dir sud;marcia20110412081808;89.6547;castel san giorgio dir sud;marcia20110412082309;89.4068;nocera pagani dir nord;marcia20110412082446;103.7815;sarno dir nord;marcia20110412082829;94.6448;palma campania dir nord;marcia20110412083333;92.4737;all a30 a16 dir nord;marcia20110412084337;113.5370;all a30 a1 dir nord;marcia20110412085201;121.0054;caserta nord dir nord;emergenza--mimeboundary_7129fcac678a04aa6ca900d73cbc34c19867765e3d9ab5e9--0 

and web service class:

@mtom @webservice(servicename = "myapp") public class myapp{ @webmethod(operationname = "sendfiledata")     public boolean sendfiledata(@webparam(name = "id") int id, @webparam(name = "loginname") string loginname, @webparam(name = "password") string password, @webparam(name = "file") @xmlmimetype("application/octet-stream") datahandler dh) throws internalserverexception, invalidsentdataexception {         logger.info(locale.getstring("web service request setueldata")); ... 

as can see soap message file correctly attached client. when web service receive soap message throws following exception:

[error] 4 java.lang.arrayindexoutofboundsexception: 4     @ org.apache.axis2.databinding.utils.beanutil.deserialize(beanutil.java:630)     @ org.apache.axis2.rpc.receivers.rpcutil.processrequest(rpcutil.java:153)     @ org.apache.axis2.rpc.receivers.rpcutil.invokeserviceclass(rpcutil.java:206)     @ org.apache.axis2.rpc.receivers.rpcmessagereceiver.invokebusinesslogic(rpcmessagereceiver.java:117)     @ org.apache.axis2.receivers.abstractinoutmessagereceiver.invokebusinesslogic(abstractinoutmessagereceiver.java:40)     @ org.apache.axis2.receivers.abstractmessagereceiver.receive(abstractmessagereceiver.java:114)     @ org.apache.axis2.engine.axisengine.receive(axisengine.java:181)     @ org.apache.axis2.transport.http.httptransportutils.processhttppostrequest(httptransportutils.java:172)     @ org.apache.axis2.transport.http.axisservlet.dopost(axisservlet.java:146)     @ javax.servlet.http.httpservlet.service(httpservlet.java:643)     @ javax.servlet.http.httpservlet.service(httpservlet.java:723)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293)     @ org.apache.coyote.http11.http11aprprocessor.process(http11aprprocessor.java:879)     @ org.apache.coyote.http11.http11aprprotocol$http11connectionhandler.process(http11aprprotocol.java:617)     @ org.apache.tomcat.util.net.aprendpoint$worker.run(aprendpoint.java:1760)     @ java.lang.thread.run(thread.java:724) 

i think problem due datahandler parameter because if send null datahandler client exception on web service not thrown. wrong in code?!

edit: noticed in soap message can see attached file (a simple csv file) if try webservice take omelement , print text of omelement have string this: mjaxmta0mtiwodazmdy7otguodk1mjtot0xbierjuibtvuq7twfyy2lhdqoymdexmdqxmja4mdk1ods5ny42mju5o1bbte1bienb...


Comments