> So the question still remains - is there any way to insert my own XML into
the SOAP body
> - without Axis having to transform it to SOAPBodyElement and back.

You're not actually "transform"ing it to a SOAPBodyElement, it's just being
"wrapped" in a SOAPBodyElement...

But I agree with your intent - it would be nice to be able to take an XML
Document object and just pass it across the wire in a SOAP Document style
call.

It appears (at least in 1.1beta source which I happen to have handy), that
the AXIS Client Call object is basing it's Message vs RPC style decision on
whether or not the arguments are all SOAPBodyElement or not, as shown in the
following code snippet from Call.invoke(Object[] params)

    /* First see if we're dealing with Messaging instead of RPC. */
    /* If ALL of the params are SOAPBodyElements then we're doing */
    /* Messaging, otherwise just fall through to normal RPC processing. */
    /********************************************************************/
    SOAPEnvelope env = null ;
    int i ;
    for ( i = 0 ; params != null && i < params.length ; i++ )
        if ( !(params[i] instanceof SOAPBodyElement) ) break ;


What would be nice is if you could set 
    call.setOperationStyle("document");
and then
    call.invoke(new Object[] { myDOMDocument });

and have it serialize the Document as the body contents, and make an
outgoing SOAP Document style (AXIS message style) call, serializing the DOM
Document as the SOAP Body, rather than forcing the use of SOAPBodyElement
and implicitly determining that it's SOAP Message/Document style based on a
known type of all the arguments...

Unfortunately, if you do that, because it's only checking for
SOAPBodyElement arguments and ignoring the setOperationStyle() property, you
will get a No Operation Specified (as if it were an RPC operation) even if
you explicitly set the operation style to Document.  Is this a design
decision of AXIS (eg, an unexpected behavior forced by JAX-RPC compliance)
or is this just a bug (that it ignores operation style and only decides
between messaging vs RPC based on existence of SOAPBodyElement args)?

..Mike





-----Original Message-----
From: Naresh Bhatia [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 12:58 PM
To: [EMAIL PROTECTED]
Subject: RE: Accessing the XML in the SOAP message body directly


Interesting approach - try to send the XML as an attachment! That's a good
workaround for me to keep in mind. However, I still prefer to send the XML
in the SOAP body. This allows me to include the associated schema in the
WSDL and then clients could choose to deserialize the body however they
think is appropriate. So the question still remains - is there any way to
insert my own XML into the SOAP body - without Axis having to transform it
to SOAPBodyElement and back.
 
Thanks.
Naresh
 
-----Original Message-----
From: Ghershony, Arie [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 24, 2003 12:04 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Accessing the XML in the SOAP message body directly


  hi,
I did an example of a clinet attach a document, then receive the same
document back from the server. what showld be different in the code if a
client want to receive the document from the the service only.  
 
this is the piece of  code to add an attachment:  what showld be different
if it is only receiving a file instead of attaching and receiving?
 
if(doTheDIME)
            call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
              call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);


        Object ret = call.invoke( new Object[] {
                    dhSource
                } 
            ); //Add the attachment.
 
 
thanks,
Aria

-----Original Message-----
From: Naresh Bhatia 
Sent: Friday, February 21, 2003 7:44 PM
To: [EMAIL PROTECTED]
Subject: Accessing the XML in the SOAP message body directly


I am using the Axis "Message" style service to populate the SOAP body
myself. My payload originates in an XML file, which I read into a
SOAPBodyElement. When I invoke the call, Axis obviously reconverts the
SOAPBodyElement into XML and sends it out to the server:
        SOAPBodyElement[] params = new SOAPBodyElement[1]; 
        params[0] = new SOAPBodyElement(new FileInputStream("message.xml"));

        ... 
        Vector resultElements = (Vector)call.invoke(params); 
Is there any way to avoid these unnecessay conversions from XML to
SOAPBodyElement and back? There is a similar problem with the returned
result - I don't want Axis to convert the XML returned in the response
message, I want to access the XML directly. Ah, and of course, the same
problem on the server side! Where do I start?
Thanks, 
Naresh 

Reply via email to