axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "albert quinn" <>
Subject POJO web service returning a file with a DataHandler, possible? (Lost (in the Axis 2 world) chapter 1)
Date Fri, 13 Jul 2007 11:29:26 GMT
  Hi !! :

  I'm a newbie in the Axis wolrd, I've been reading all the Axis 2
docs and then, I've started to try this and that to discover how could
i do what i need the easiest way.

  I need to do a web service receiving a file in a
javax.activation.DataHandler  and saving it to the file system and
another web service returning a file from the file system in a

  So I've tried to do that in the easiest way. I've created this web
service class :

package code.prueba;

import ....

public class PruebaBD {

  public DataHandler getFile() {

    DataHandler oDataHandler = new DataHandler( new FileDataSource(
"C:\\prueba\\file.txt" ) );

    return oDataHandler;	


  Then I've used the Eclipse plugin "Axis 2 Service Archiver" to
generate the ".aar" file and I've deployed the web service in Axis 2.
I can see the service up and runnning in :

  So, I've used the "POJO Web Services using Apache Axis2" tutorial to
create a client for the deployed web service using the
RPCServiceClient. This is my client :

package code.prueba;

import ....

public class RPClient {
  public static void main(String[] args) {
    try {

      RPCServiceClient serviceClient = new RPCServiceClient();
      Options options = serviceClient.getOptions();
      EndpointReference target = new EndpointReference
      QName op = new QName("http://prueba.code/xsd", "getFile");
      Object[]  opArgs= new Object[] { };
      Class[] returnTypes = new Class[] { DataHandler.class };

      Object[] response = serviceClient.invokeBlocking(op, opArgs, returnTypes);
      DataHandler dh = (DataHandler) response[0];
      if (dh == null)
          System.out.println("ERROR !!! dh == NULL");
      else {
          System.out.println("file name : " + dh.getName() );
          FileOutputStream fos = new FileOutputStream( "C:\\prueba\\file.txt" );
  } catch (AxisFault fault) {
      System.out.println("ERROR !!!!! Fault.");
  } catch(Exception oException) {
      System.out.println("ERROR !!!!! Exception.");

  When I've runned my RPClient, I've got that Exception :

ERROR !!!!! Exception.
com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a
close tag for element <faultstring>
 at [row,col {unknown-source}]: [1,193]
	at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.processText(
	at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.handleEvent(
	at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(
	at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(
	at org.apache.axiom.soap.impl.llom.soap11.SOAP11FaultImpl.getCode(
	at org.apache.axis2.AxisFault.initializeValues(
	at org.apache.axis2.AxisFault.<init>(
	at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(
	at org.apache.axis2.description.OutInAxisOperationClient.send(
	at org.apache.axis2.description.OutInAxisOperationClient.execute(
	at org.apache.axis2.client.ServiceClient.sendReceive(
	at org.apache.axis2.client.ServiceClient.sendReceive(
	at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(
	at borrar.main(
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was
expecting a close tag for element <faultstring>
 at [row,col {unknown-source}]: [1,193]
	at org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.processText(
	... 19 more

  So, my question is : am I doing something wrong? is not possible to
do a POJO service returning a file in a DataHandler? If it's possible
to do a POJO service that way, is it possible to do a RPC client that
way? If not, what kind of client should I do?

  Many thanks to any Axis 2 guru who give me any ideas about what to
do to get up and running the Web Service I need to do.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message