Hi All,

 

I have taken the mtom example provided with Axis2, modified a little bit.

 

Now I am sending the file as a binary data to web service and when I try to get the datahandler reference at the web service I am getting an exception. Following is the exception stack trace attached.

 

2006-10-15 00:17:37,141 INFO  [STDOUT] Trying to get datahandler from OMText ...

2006-10-15 00:17:37,156 ERROR [org.jboss.web.localhost.Engine] [EMAIL PROTECTED]: Exception Processing ErrorPage[errorCode=500, location=/axis2-web/Error/error500.jsp]

java.lang.IllegalStateException

          at org.apache.coyote.Response.reset(Response.java:296)

          at org.apache.coyote.tomcat5.CoyoteResponse.reset(CoyoteResponse.java:645)

          at org.apache.coyote.tomcat5.CoyoteResponse.reset(CoyoteResponse.java:911)

          at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:389)

          at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:147)

          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)

          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)

          at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)

          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

          at java.lang.Thread.run(Unknown Source)

 

 

Following are the code snippets for the Web Services Client and the Web  Service  code.

 

             

              DataSource fDS=new FileDataSource(new File("D:\\eclipse\\eclipse\\workspace\\WebSvcs_Axis2\\Sample_Assmt.xml"));

              expectedDH = new DataHandler(fDS);

              OMText textData = fac.createOMText(expectedDH,true);

              fileRef.addChild(textData);

              OMElement xmlFileName = fac.createOMElement("fileName", omNs);

              xmlFileName.setText("Sample_Assmt.xml");

              WSName.addChild(xmlFileName);

              WSName.addChild(fileRef);

 

 

OMText binaryNode = (OMText) fileElement.getFirstOMChild();

       

       System.out.println("Got OMText ...");

       System.out.println("Priniting OMText"+binaryNode);

       

       

   DataHandler actualDH;

   System.out.println("Trying to get datahandler from OMText ...");

   actualDH = (DataHandler) binaryNode.getDataHandler();

  //// System.out.println("Got the DataHandler reference.Calling getInputString method..."+actualDH);

  

       char[] cbuf;

         System.out.println("Trying to get datahandler from OMText with content type ...");

         //actualDH = (DataHandler) binaryNode.getDataHandler();

         actualDH = new DataHandler (binaryNode.getDataHandler(),"text/xml");

         //System.out.println("Trying to get datahandler from OMText ..."+actualDH);

         System.out.println("Trying to build input stream reader ...");

         InputStreamReader reader = new InputStreamReader(actualDH.getDataSource().getInputStream());

 

 

 

Any help is appreicated.

 

Thanks,

Ramkumar

Reply via email to