Hello,

I'm pretty new to SOAP too so don'tknow how much help I'll be. I have been succesfully sending images with Apache SOAP using the byte array serializer but I don't know much about the server side - except that it's happy with what I'm sending!

I've found the following link quite useful:
http://www-106.ibm.com/developerworks/webservices/library/ws-soapmap1/

I've noticed that DataHandler types use the MimePartSerializer and byte[]'s the base64Serializer.

Are you using SOAP with attachments?

Barry


At 07:13 06/07/2003, you wrote:
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