To do what you are trying to do with Apache SOAP, you would need to 
write a serializer for Element.  As you have experienced, Apache SOAP 
lets you [de-]serialize an Element through its custom literal XML 
encoding.  When using literal XML, you can only [de-]serialize 
Element.  For standard SOAP encoding, there is no Element serializer.

The standard workarounds are to use either (1) the XML as a string or 
(2) Java classes appropriate for your problem domain, instead of 
Element.

On 6 Jul 2003 at 8:13, R.Domingo 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;
>       }
> 
> 
> 


Scott Nichol

Do not reply directly to this e-mail address,
as it is filtered to only receive e-mail from
specific mailing lists.


Reply via email to