You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ulrich Winter <ul...@gmx.de> on 2002/09/24 11:51:55 UTC

problems issuing a call using soap with attachments

Hi,

I've problems issuing a call which should use attachments for some
parameters.

I've setup a Call object and user DataHandler type as parameter.
I've worked along the example from the WROX book on Axis.

The resulting http request does not use mime multipart/related format.
Instead it issues a non-mime simple http request with a plain soap envelope
as its content.

What am I missing?

Here is the code of the client:


      String filename = "data";
      DataHandler dhSource = new DataHandler(new FileDataSource(filename));
      String endpointUrl =
"http://localhost:8080/axis/services/AttachmentService";
      String methodName = "EchoAttachment";
      Service service = new Service();
      Call call = (org.apache.axis.client.Call)service.createCall();
      call.setTargetEndpointAddress(endpointUrl);
      call.setOperationName(new QName("AttachmentService", methodName));
      QName qnameParamIn = new
javax.xml.namespace.QName("http://xml.apache.org/xml-soap", "DataHandler");
      call.addParameter(
          new javax.xml.namespace.QName("", "In"),
          qnameParamIn,
          javax.activation.DataHandler.class,
          javax.xml.rpc.ParameterMode.IN);
      call.registerTypeMapping(dhSource.getClass(), qnameParamIn,
JAFDataHandlerSerializerFactory.class,
JAFDataHandlerDeserializerFactory.class);

      call.setReturnType(new QName("http://xml.apache.org/xml-soap",
"DataHandler"), javax.activation.DataHandler.class);

      java.lang.Object response = call.invoke(new java.lang.Object[]
{dhSource});