You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Frank Starsinic <fs...@apengines.com> on 2001/01/10 01:15:24 UTC

passing XML in as a paramter using NS_URI_LITERAL_XML

i started trying the soap api and wrote some code like this...

        XMLParserLiaison xpl = new XercesParserLiaison();
        Document doc = xpl.read("- User File -", UserFile);
        Element root = doc.getDocumentElement();
        Vector params = new Vector();
        params.addElement(new Parameter("X",
                                        Element.class,
                                        root,
                                        Constants.NS_URI_LITERAL_XML));
        call.setParams(params);


passing in an XML document as "root" that looked something like this...

<serviceability>
   <name>me</name>
   <number>1</number>
</serviceability>


BUT, when i add this xml as a parameter, the soap api, automatically
wraps that xml in a tag of whatever name i give it, say "X"...

so i end up with...

<X>
 <serviceability>
   <name>me</name>
   <number>1</number>
 </serviceability>
<X>

which will not work with our customer.
they are expecting just 

<serviceability>
   <name>me</name>
   <number>1</number>
</serviceability>


so i tried taking out the <serviceability> tag from the xml
and added the parameter "serviceability" to automatically 
create the serviceability tag for me and got an error that
the original XML was not formatted properly because it just
looked like...

   <name>me</name>
   <number>1</number>


seems like a catch-22 to me.  
either i start with bad xml (which won't work)
or i pass bad xml to the customer (which won't work) 
or i'm doing something wrong (probably true)


any ideas?

thanks,

frank


RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Frank Starsinic <fs...@apengines.com>.
Ok. this perhaps sounds like the way to go if i already have XML.
skip the call() stuff and go right to creating the body, envelope, 
and message. i can't find the Message class.  here's how far i get...

it looks like the method that will accept a DOM Element is 
Body b = Body.unmarshall(Node n);

and the Envelope method would then be

Envelope e = new Envelope();
e.setBody(b);

That's great but I don't see a org.apache.soap.messaging.Message 
class anywhere. :(

is it the org.apache.soap.rpc.RPCMessage class???

anyway, i don't see the facility for sending a message or getting back
a response from the soap server. am i expected to create an envelope and 
just do HTTP Post request from scratch at that point?

thanks. very helpful. i appreciate it. :),

frank


> -----Original Message-----
> From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> Sent: Wednesday, January 10, 2001 10:44 AM
> To: soap-user@xml.apache.org
> Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
> 
> 
> Are you trying to implement a SOAP RPC-style system? That is, 
> one that 
> follows Section 7 of [1]? 
> 
> If so, I don't think you can do what you want using the Call 
> mechanism as 
> is. The source of your issue is the 
> org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It 
> assumes the name of the RPC parameter is the Parameter object's name 
> attribute, and therefore wraps the literal XML with an aptly named 
> element. You could simply modify this class to only wrap the 
> literal XML 
> when the Parameter has a non-null name. If you do this, I suggest 
> submitting the modified class as a patch to the soap-dev list.
> 
> If not, there is no reason to to use the Call mechanism. I suggest 
> instead using the generic messaging mechanism implementing in 
> org.apache.soap.messaging.Message. Here, you just add your 
> DOM element to 
> a org.apache.soap.Body object, add the Body to an 
> org.apache.soap.Envelope object, and use the Message object 
> to send the 
> Envelope.
> 
> [1] http://www.w3.org/TR/SOAP
> 
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> 
> On 1/9/01, 7:15:24 PM, Frank Starsinic 
> <fs...@apengines.com> wrote 
> regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
> 
> 
> > i started trying the soap api and wrote some code like this...
> 
> >         XMLParserLiaison xpl = new XercesParserLiaison();
> >         Document doc = xpl.read("- User File -", UserFile);
> >         Element root = doc.getDocumentElement();
> >         Vector params = new Vector();
> >         params.addElement(new Parameter("X",
> >                                         Element.class,
> >                                         root,
> >                                         
> Constants.NS_URI_LITERAL_XML));
> >         call.setParams(params);
> 
> 
> > passing in an XML document as "root" that looked something 
> like this...
> 
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
> 
> 
> > BUT, when i add this xml as a parameter, the soap api, automatically
> > wraps that xml in a tag of whatever name i give it, say "X"...
> 
> > so i end up with...
> 
> > <X>
> >  <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> >  </serviceability>
> > <X>
> 
> > which will not work with our customer.
> > they are expecting just
> 
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
> 
> 
> > so i tried taking out the <serviceability> tag from the xml
> > and added the parameter "serviceability" to automatically
> > create the serviceability tag for me and got an error that
> > the original XML was not formatted properly because it just
> > looked like...
> 
> >    <name>me</name>
> >    <number>1</number>
> 
> 
> > seems like a catch-22 to me.
> > either i start with bad xml (which won't work)
> > or i pass bad xml to the customer (which won't work)
> > or i'm doing something wrong (probably true)
> 
> 
> > any ideas?
> 
> > thanks,
> 
> > frank
> 
> 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
> 


RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Kevin Mitchell <ke...@xmls.com>.
Call the receive() method on same Message object you called send() on.  
receive() returns an Envelope object.
This works only if the server responds synchronously, of course.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/10/01, 4:09:54 PM, Frank Starsinic <fs...@apengines.com> wrote 
regarding RE: passing XML in as a paramter using NS_URI_LITERAL_XML:


> i saw in the 2.1 SOAP the org.apache.soap.messaging.Message class.

> it has a send(URL u, String s, Envelope e) method which is great.

> Since the send() method is void, what method on the Message class, in 
this
> case would be used to
> recieve the data from the soap server?


> thanks,

> frank


> > -----Original Message-----
> > From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> > Sent: Wednesday, January 10, 2001 10:44 AM
> > To: soap-user@xml.apache.org
> > Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
> >
> >
> > Are you trying to implement a SOAP RPC-style system? That is,
> > one that
> > follows Section 7 of [1]?
> >
> > If so, I don't think you can do what you want using the Call
> > mechanism as
> > is. The source of your issue is the
> > org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It
> > assumes the name of the RPC parameter is the Parameter object's name
> > attribute, and therefore wraps the literal XML with an aptly named
> > element. You could simply modify this class to only wrap the
> > literal XML
> > when the Parameter has a non-null name. If you do this, I suggest
> > submitting the modified class as a patch to the soap-dev list.
> >
> > If not, there is no reason to to use the Call mechanism. I suggest
> > instead using the generic messaging mechanism implementing in
> > org.apache.soap.messaging.Message. Here, you just add your
> > DOM element to
> > a org.apache.soap.Body object, add the Body to an
> > org.apache.soap.Envelope object, and use the Message object
> > to send the
> > Envelope.
> >
> > [1] http://www.w3.org/TR/SOAP
> >
> > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> >
> > On 1/9/01, 7:15:24 PM, Frank Starsinic
> > <fs...@apengines.com> wrote
> > regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
> >
> >
> > > i started trying the soap api and wrote some code like this...
> >
> > >         XMLParserLiaison xpl = new XercesParserLiaison();
> > >         Document doc = xpl.read("- User File -", UserFile);
> > >         Element root = doc.getDocumentElement();
> > >         Vector params = new Vector();
> > >         params.addElement(new Parameter("X",
> > >                                         Element.class,
> > >                                         root,
> > >
> > Constants.NS_URI_LITERAL_XML));
> > >         call.setParams(params);
> >
> >
> > > passing in an XML document as "root" that looked something
> > like this...
> >
> > > <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > > </serviceability>
> >
> >
> > > BUT, when i add this xml as a parameter, the soap api, automatically
> > > wraps that xml in a tag of whatever name i give it, say "X"...
> >
> > > so i end up with...
> >
> > > <X>
> > >  <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > >  </serviceability>
> > > <X>
> >
> > > which will not work with our customer.
> > > they are expecting just
> >
> > > <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > > </serviceability>
> >
> >
> > > so i tried taking out the <serviceability> tag from the xml
> > > and added the parameter "serviceability" to automatically
> > > create the serviceability tag for me and got an error that
> > > the original XML was not formatted properly because it just
> > > looked like...
> >
> > >    <name>me</name>
> > >    <number>1</number>
> >
> >
> > > seems like a catch-22 to me.
> > > either i start with bad xml (which won't work)
> > > or i pass bad xml to the customer (which won't work)
> > > or i'm doing something wrong (probably true)
> >
> >
> > > any ideas?
> >
> > > thanks,
> >
> > > frank
> >
> >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > > For additional commands, email: soap-user-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> >


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Kevin Mitchell <ke...@xmls.com>.
Call the receive() method on same Message object you called send() on.  
receive() returns an Envelope object.
This works only if the server responds synchronously, of course.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/10/01, 4:09:54 PM, Frank Starsinic <fs...@apengines.com> wrote 
regarding RE: passing XML in as a paramter using NS_URI_LITERAL_XML:


> i saw in the 2.1 SOAP the org.apache.soap.messaging.Message class.

> it has a send(URL u, String s, Envelope e) method which is great.

> Since the send() method is void, what method on the Message class, in 
this
> case would be used to
> recieve the data from the soap server?


> thanks,

> frank


> > -----Original Message-----
> > From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> > Sent: Wednesday, January 10, 2001 10:44 AM
> > To: soap-user@xml.apache.org
> > Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
> >
> >
> > Are you trying to implement a SOAP RPC-style system? That is,
> > one that
> > follows Section 7 of [1]?
> >
> > If so, I don't think you can do what you want using the Call
> > mechanism as
> > is. The source of your issue is the
> > org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It
> > assumes the name of the RPC parameter is the Parameter object's name
> > attribute, and therefore wraps the literal XML with an aptly named
> > element. You could simply modify this class to only wrap the
> > literal XML
> > when the Parameter has a non-null name. If you do this, I suggest
> > submitting the modified class as a patch to the soap-dev list.
> >
> > If not, there is no reason to to use the Call mechanism. I suggest
> > instead using the generic messaging mechanism implementing in
> > org.apache.soap.messaging.Message. Here, you just add your
> > DOM element to
> > a org.apache.soap.Body object, add the Body to an
> > org.apache.soap.Envelope object, and use the Message object
> > to send the
> > Envelope.
> >
> > [1] http://www.w3.org/TR/SOAP
> >
> > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> >
> > On 1/9/01, 7:15:24 PM, Frank Starsinic
> > <fs...@apengines.com> wrote
> > regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
> >
> >
> > > i started trying the soap api and wrote some code like this...
> >
> > >         XMLParserLiaison xpl = new XercesParserLiaison();
> > >         Document doc = xpl.read("- User File -", UserFile);
> > >         Element root = doc.getDocumentElement();
> > >         Vector params = new Vector();
> > >         params.addElement(new Parameter("X",
> > >                                         Element.class,
> > >                                         root,
> > >
> > Constants.NS_URI_LITERAL_XML));
> > >         call.setParams(params);
> >
> >
> > > passing in an XML document as "root" that looked something
> > like this...
> >
> > > <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > > </serviceability>
> >
> >
> > > BUT, when i add this xml as a parameter, the soap api, automatically
> > > wraps that xml in a tag of whatever name i give it, say "X"...
> >
> > > so i end up with...
> >
> > > <X>
> > >  <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > >  </serviceability>
> > > <X>
> >
> > > which will not work with our customer.
> > > they are expecting just
> >
> > > <serviceability>
> > >    <name>me</name>
> > >    <number>1</number>
> > > </serviceability>
> >
> >
> > > so i tried taking out the <serviceability> tag from the xml
> > > and added the parameter "serviceability" to automatically
> > > create the serviceability tag for me and got an error that
> > > the original XML was not formatted properly because it just
> > > looked like...
> >
> > >    <name>me</name>
> > >    <number>1</number>
> >
> >
> > > seems like a catch-22 to me.
> > > either i start with bad xml (which won't work)
> > > or i pass bad xml to the customer (which won't work)
> > > or i'm doing something wrong (probably true)
> >
> >
> > > any ideas?
> >
> > > thanks,
> >
> > > frank
> >
> >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > > For additional commands, email: soap-user-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> >


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Frank Starsinic <fs...@apengines.com>.
i saw in the 2.1 SOAP the org.apache.soap.messaging.Message class.

it has a send(URL u, String s, Envelope e) method which is great.

Since the send() method is void, what method on the Message class, in this
case would be used to
recieve the data from the soap server?


thanks,

frank


> -----Original Message-----
> From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> Sent: Wednesday, January 10, 2001 10:44 AM
> To: soap-user@xml.apache.org
> Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
>
>
> Are you trying to implement a SOAP RPC-style system? That is,
> one that
> follows Section 7 of [1]?
>
> If so, I don't think you can do what you want using the Call
> mechanism as
> is. The source of your issue is the
> org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It
> assumes the name of the RPC parameter is the Parameter object's name
> attribute, and therefore wraps the literal XML with an aptly named
> element. You could simply modify this class to only wrap the
> literal XML
> when the Parameter has a non-null name. If you do this, I suggest
> submitting the modified class as a patch to the soap-dev list.
>
> If not, there is no reason to to use the Call mechanism. I suggest
> instead using the generic messaging mechanism implementing in
> org.apache.soap.messaging.Message. Here, you just add your
> DOM element to
> a org.apache.soap.Body object, add the Body to an
> org.apache.soap.Envelope object, and use the Message object
> to send the
> Envelope.
>
> [1] http://www.w3.org/TR/SOAP
>
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
>
> On 1/9/01, 7:15:24 PM, Frank Starsinic
> <fs...@apengines.com> wrote
> regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
>
>
> > i started trying the soap api and wrote some code like this...
>
> >         XMLParserLiaison xpl = new XercesParserLiaison();
> >         Document doc = xpl.read("- User File -", UserFile);
> >         Element root = doc.getDocumentElement();
> >         Vector params = new Vector();
> >         params.addElement(new Parameter("X",
> >                                         Element.class,
> >                                         root,
> >
> Constants.NS_URI_LITERAL_XML));
> >         call.setParams(params);
>
>
> > passing in an XML document as "root" that looked something
> like this...
>
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
>
>
> > BUT, when i add this xml as a parameter, the soap api, automatically
> > wraps that xml in a tag of whatever name i give it, say "X"...
>
> > so i end up with...
>
> > <X>
> >  <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> >  </serviceability>
> > <X>
>
> > which will not work with our customer.
> > they are expecting just
>
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
>
>
> > so i tried taking out the <serviceability> tag from the xml
> > and added the parameter "serviceability" to automatically
> > create the serviceability tag for me and got an error that
> > the original XML was not formatted properly because it just
> > looked like...
>
> >    <name>me</name>
> >    <number>1</number>
>
>
> > seems like a catch-22 to me.
> > either i start with bad xml (which won't work)
> > or i pass bad xml to the customer (which won't work)
> > or i'm doing something wrong (probably true)
>
>
> > any ideas?
>
> > thanks,
>
> > frank
>
>
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>


RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Frank Starsinic <fs...@apengines.com>.
i saw in the 2.1 SOAP the org.apache.soap.messaging.Message class.

it has a send(URL u, String s, Envelope e) method which is great.

Since the send() method is void, what method on the Message class, in this
case would be used to
recieve the data from the soap server?


thanks,

frank


> -----Original Message-----
> From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> Sent: Wednesday, January 10, 2001 10:44 AM
> To: soap-user@xml.apache.org
> Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
>
>
> Are you trying to implement a SOAP RPC-style system? That is,
> one that
> follows Section 7 of [1]?
>
> If so, I don't think you can do what you want using the Call
> mechanism as
> is. The source of your issue is the
> org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It
> assumes the name of the RPC parameter is the Parameter object's name
> attribute, and therefore wraps the literal XML with an aptly named
> element. You could simply modify this class to only wrap the
> literal XML
> when the Parameter has a non-null name. If you do this, I suggest
> submitting the modified class as a patch to the soap-dev list.
>
> If not, there is no reason to to use the Call mechanism. I suggest
> instead using the generic messaging mechanism implementing in
> org.apache.soap.messaging.Message. Here, you just add your
> DOM element to
> a org.apache.soap.Body object, add the Body to an
> org.apache.soap.Envelope object, and use the Message object
> to send the
> Envelope.
>
> [1] http://www.w3.org/TR/SOAP
>
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
>
> On 1/9/01, 7:15:24 PM, Frank Starsinic
> <fs...@apengines.com> wrote
> regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
>
>
> > i started trying the soap api and wrote some code like this...
>
> >         XMLParserLiaison xpl = new XercesParserLiaison();
> >         Document doc = xpl.read("- User File -", UserFile);
> >         Element root = doc.getDocumentElement();
> >         Vector params = new Vector();
> >         params.addElement(new Parameter("X",
> >                                         Element.class,
> >                                         root,
> >
> Constants.NS_URI_LITERAL_XML));
> >         call.setParams(params);
>
>
> > passing in an XML document as "root" that looked something
> like this...
>
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
>
>
> > BUT, when i add this xml as a parameter, the soap api, automatically
> > wraps that xml in a tag of whatever name i give it, say "X"...
>
> > so i end up with...
>
> > <X>
> >  <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> >  </serviceability>
> > <X>
>
> > which will not work with our customer.
> > they are expecting just
>
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
>
>
> > so i tried taking out the <serviceability> tag from the xml
> > and added the parameter "serviceability" to automatically
> > create the serviceability tag for me and got an error that
> > the original XML was not formatted properly because it just
> > looked like...
>
> >    <name>me</name>
> >    <number>1</number>
>
>
> > seems like a catch-22 to me.
> > either i start with bad xml (which won't work)
> > or i pass bad xml to the customer (which won't work)
> > or i'm doing something wrong (probably true)
>
>
> > any ideas?
>
> > thanks,
>
> > frank
>
>
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>


RE: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Frank Starsinic <fs...@apengines.com>.
Ok. this perhaps sounds like the way to go if i already have XML.
skip the call() stuff and go right to creating the body, envelope, 
and message. i can't find the Message class.  here's how far i get...

it looks like the method that will accept a DOM Element is 
Body b = Body.unmarshall(Node n);

and the Envelope method would then be

Envelope e = new Envelope();
e.setBody(b);

That's great but I don't see a org.apache.soap.messaging.Message 
class anywhere. :(

is it the org.apache.soap.rpc.RPCMessage class???

anyway, i don't see the facility for sending a message or getting back
a response from the soap server. am i expected to create an envelope and 
just do HTTP Post request from scratch at that point?

thanks. very helpful. i appreciate it. :),

frank


> -----Original Message-----
> From: Kevin Mitchell [mailto:kevin.mitchell@xmls.com]
> Sent: Wednesday, January 10, 2001 10:44 AM
> To: soap-user@xml.apache.org
> Subject: Re: passing XML in as a paramter using NS_URI_LITERAL_XML
> 
> 
> Are you trying to implement a SOAP RPC-style system? That is, 
> one that 
> follows Section 7 of [1]? 
> 
> If so, I don't think you can do what you want using the Call 
> mechanism as 
> is. The source of your issue is the 
> org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It 
> assumes the name of the RPC parameter is the Parameter object's name 
> attribute, and therefore wraps the literal XML with an aptly named 
> element. You could simply modify this class to only wrap the 
> literal XML 
> when the Parameter has a non-null name. If you do this, I suggest 
> submitting the modified class as a patch to the soap-dev list.
> 
> If not, there is no reason to to use the Call mechanism. I suggest 
> instead using the generic messaging mechanism implementing in 
> org.apache.soap.messaging.Message. Here, you just add your 
> DOM element to 
> a org.apache.soap.Body object, add the Body to an 
> org.apache.soap.Envelope object, and use the Message object 
> to send the 
> Envelope.
> 
> [1] http://www.w3.org/TR/SOAP
> 
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> 
> On 1/9/01, 7:15:24 PM, Frank Starsinic 
> <fs...@apengines.com> wrote 
> regarding passing XML in as a paramter using NS_URI_LITERAL_XML:
> 
> 
> > i started trying the soap api and wrote some code like this...
> 
> >         XMLParserLiaison xpl = new XercesParserLiaison();
> >         Document doc = xpl.read("- User File -", UserFile);
> >         Element root = doc.getDocumentElement();
> >         Vector params = new Vector();
> >         params.addElement(new Parameter("X",
> >                                         Element.class,
> >                                         root,
> >                                         
> Constants.NS_URI_LITERAL_XML));
> >         call.setParams(params);
> 
> 
> > passing in an XML document as "root" that looked something 
> like this...
> 
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
> 
> 
> > BUT, when i add this xml as a parameter, the soap api, automatically
> > wraps that xml in a tag of whatever name i give it, say "X"...
> 
> > so i end up with...
> 
> > <X>
> >  <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> >  </serviceability>
> > <X>
> 
> > which will not work with our customer.
> > they are expecting just
> 
> > <serviceability>
> >    <name>me</name>
> >    <number>1</number>
> > </serviceability>
> 
> 
> > so i tried taking out the <serviceability> tag from the xml
> > and added the parameter "serviceability" to automatically
> > create the serviceability tag for me and got an error that
> > the original XML was not formatted properly because it just
> > looked like...
> 
> >    <name>me</name>
> >    <number>1</number>
> 
> 
> > seems like a catch-22 to me.
> > either i start with bad xml (which won't work)
> > or i pass bad xml to the customer (which won't work)
> > or i'm doing something wrong (probably true)
> 
> 
> > any ideas?
> 
> > thanks,
> 
> > frank
> 
> 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
> 


Re: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Kevin Mitchell <ke...@xmls.com>.
Are you trying to implement a SOAP RPC-style system? That is, one that 
follows Section 7 of [1]? 

If so, I don't think you can do what you want using the Call mechanism as 
is. The source of your issue is the 
org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It 
assumes the name of the RPC parameter is the Parameter object's name 
attribute, and therefore wraps the literal XML with an aptly named 
element. You could simply modify this class to only wrap the literal XML 
when the Parameter has a non-null name. If you do this, I suggest 
submitting the modified class as a patch to the soap-dev list.

If not, there is no reason to to use the Call mechanism. I suggest 
instead using the generic messaging mechanism implementing in 
org.apache.soap.messaging.Message. Here, you just add your DOM element to 
a org.apache.soap.Body object, add the Body to an 
org.apache.soap.Envelope object, and use the Message object to send the 
Envelope.

[1] http://www.w3.org/TR/SOAP

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/9/01, 7:15:24 PM, Frank Starsinic <fs...@apengines.com> wrote 
regarding passing XML in as a paramter using NS_URI_LITERAL_XML:


> i started trying the soap api and wrote some code like this...

>         XMLParserLiaison xpl = new XercesParserLiaison();
>         Document doc = xpl.read("- User File -", UserFile);
>         Element root = doc.getDocumentElement();
>         Vector params = new Vector();
>         params.addElement(new Parameter("X",
>                                         Element.class,
>                                         root,
>                                         Constants.NS_URI_LITERAL_XML));
>         call.setParams(params);


> passing in an XML document as "root" that looked something like this...

> <serviceability>
>    <name>me</name>
>    <number>1</number>
> </serviceability>


> BUT, when i add this xml as a parameter, the soap api, automatically
> wraps that xml in a tag of whatever name i give it, say "X"...

> so i end up with...

> <X>
>  <serviceability>
>    <name>me</name>
>    <number>1</number>
>  </serviceability>
> <X>

> which will not work with our customer.
> they are expecting just

> <serviceability>
>    <name>me</name>
>    <number>1</number>
> </serviceability>


> so i tried taking out the <serviceability> tag from the xml
> and added the parameter "serviceability" to automatically
> create the serviceability tag for me and got an error that
> the original XML was not formatted properly because it just
> looked like...

>    <name>me</name>
>    <number>1</number>


> seems like a catch-22 to me.
> either i start with bad xml (which won't work)
> or i pass bad xml to the customer (which won't work)
> or i'm doing something wrong (probably true)


> any ideas?

> thanks,

> frank


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

Re: passing XML in as a paramter using NS_URI_LITERAL_XML

Posted by Kevin Mitchell <ke...@xmls.com>.
Are you trying to implement a SOAP RPC-style system? That is, one that 
follows Section 7 of [1]? 

If so, I don't think you can do what you want using the Call mechanism as 
is. The source of your issue is the 
org.apache.soap.encoding.literalxml.XMLParameterSerializer class.  It 
assumes the name of the RPC parameter is the Parameter object's name 
attribute, and therefore wraps the literal XML with an aptly named 
element. You could simply modify this class to only wrap the literal XML 
when the Parameter has a non-null name. If you do this, I suggest 
submitting the modified class as a patch to the soap-dev list.

If not, there is no reason to to use the Call mechanism. I suggest 
instead using the generic messaging mechanism implementing in 
org.apache.soap.messaging.Message. Here, you just add your DOM element to 
a org.apache.soap.Body object, add the Body to an 
org.apache.soap.Envelope object, and use the Message object to send the 
Envelope.

[1] http://www.w3.org/TR/SOAP

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/9/01, 7:15:24 PM, Frank Starsinic <fs...@apengines.com> wrote 
regarding passing XML in as a paramter using NS_URI_LITERAL_XML:


> i started trying the soap api and wrote some code like this...

>         XMLParserLiaison xpl = new XercesParserLiaison();
>         Document doc = xpl.read("- User File -", UserFile);
>         Element root = doc.getDocumentElement();
>         Vector params = new Vector();
>         params.addElement(new Parameter("X",
>                                         Element.class,
>                                         root,
>                                         Constants.NS_URI_LITERAL_XML));
>         call.setParams(params);


> passing in an XML document as "root" that looked something like this...

> <serviceability>
>    <name>me</name>
>    <number>1</number>
> </serviceability>


> BUT, when i add this xml as a parameter, the soap api, automatically
> wraps that xml in a tag of whatever name i give it, say "X"...

> so i end up with...

> <X>
>  <serviceability>
>    <name>me</name>
>    <number>1</number>
>  </serviceability>
> <X>

> which will not work with our customer.
> they are expecting just

> <serviceability>
>    <name>me</name>
>    <number>1</number>
> </serviceability>


> so i tried taking out the <serviceability> tag from the xml
> and added the parameter "serviceability" to automatically
> create the serviceability tag for me and got an error that
> the original XML was not formatted properly because it just
> looked like...

>    <name>me</name>
>    <number>1</number>


> seems like a catch-22 to me.
> either i start with bad xml (which won't work)
> or i pass bad xml to the customer (which won't work)
> or i'm doing something wrong (probably true)


> any ideas?

> thanks,

> frank


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org