I'm currently working on my first production application using soap.
But the last I need to finish is causing problems.

I need to send an image to the server and respond with a
org.w3c.dom.Element.

If I use 'Constants.NS_URI_SOAP_ENC' the images is arriving at my server,
but I can't deserialize the 'org.w3c.dom.Element'.

If I use 'Constants.NS_URI_LITERAL_XML' I can't serialize the image.

This is my code at the client side:

try {
      photoDataSource = new ByteArrayDataSource(
          photoDataStream,
          "application/octet-stream");
      photoDataHandler = new DataHandler(
          photoDataSource);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (photoDataSource!=null && photoDataHandler!=null) {
      // Build the call.
      Call call = new Call();
      call.setSOAPMappingRegistry(soapRegistry);
      call.setTargetObjectURI("urn:PhotoService");
      call.setMethodName("createPhoto");
      call.setEncodingStyleURI(paramEncodingStyleURI);

      Vector params = new Vector();
      params.addElement(
          new Parameter("sessionId", String.class, sessionId,
paramEncodingStyleURI));
      params.addElement(
          new Parameter("publication", String.class, publication,
paramEncodingStyleURI));
      params.addElement(
          new Parameter("size", String.class, size, paramEncodingStyleURI));
      params.addElement(new Parameter( "photoData",
javax.activation.DataHandler.class, photoDataHandler, null));
      call.setParams(params);

      // Invoke the call.
      Response resp;
      try {
        resp = call.invoke(soapRouterUrl, "");
      } catch (SOAPException e) {
        System.err.println("Caught SOAPException (" +
            e.getFaultCode() + "): " +
            e.getMessage());
        return null;
      }


Reply via email to