You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Naggi Rao <na...@softhome.net> on 2001/05/01 00:21:46 UTC

A Simple XML Question ..but I am stuck !

Hi all,
Please excuse me for posing such a simple question in this list.But I am
stuck and I dont seem to have any solution..
All I am trying to do is to embed a XML String in a SOAP response..
that is in my registered SOAP  service I want to return a XML String.
Which I am constructing ..using the JDOM APIs
But I want to remove the version,encoding info from that since it is already
embedded inside the SOAP XML...
Ex:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP Envelope>
.....
<response>
<myname>Naggi</myname>
<urname>Joe</urname>
</response>
.....
</SOAP Envelope>
BUT THE JDOM PARSER ADDS A

<?xml version="1.0" encoding="UTF-8"?>
<SOAP Envelope>
.....
<!--aDDED BY THE jdom STUFF which I want to remove
!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<?xml version="1.0" encoding="UTF-8"?>
<response>
<myname>Naggi</myname>
<urname>Joe</urname>
</response>
.....
</SOAP Envelope>


How could I remove it ???
I have "graduated" from SAX so my knowledge about JDOM and DOM is limited !!
PLEASE help me if u can !!

Cheers,
Naggi



Re: A Simple XML Question ..but I am stuck !

Posted by Naggi Rao <na...@softhome.net>.
yeah I agree,
but I could atleast explore it..
Although I would be pretty clumsy..


----- Original Message -----
From: "Kartheek Hirode" <ka...@centegy.com>
To: <so...@xml.apache.org>
Sent: Monday, April 30, 2001 4:13 PM
Subject: RE: A Simple XML Question ..but I am stuck !


>
> When you output an XMLDocument from JDOM, it mandatorily puts the XML
prolog
> (<?xml...> in the output string. So, I don't think there is a way around
it
> other than doing the cleaning manually (which is kludgey).
> Your problem is the classical "XML payloads thru' SOAP" issue. SOAP (and
> Apache-SOAP) till now has maintained independance (thereby, lack of
support)
> from payload formatss and hence XML payloads are the developer's onus to
> handle. You could Base64 encode the payload to hide the XML prolog and
SOAP
> will not complain. (Base64, however, adds to the size of the packet...up
> 30%)
>
> The other approach you could use is to serialize the RootElement using the
> "LiteralXML" encoding
> that Apache-SOAP provides, but this too is a resource hog for big XML
> payloads.
> --KH
>
>
> -----Original Message-----
> From: Naggi Rao [mailto:naggi@softhome.net]
> Sent: Monday, April 30, 2001 3:22 PM
> To: soap-dev@xml.apache.org
> Subject: A Simple XML Question ..but I am stuck !
>
>
> Hi all,
> Please excuse me for posing such a simple question in this list.But I am
> stuck and I dont seem to have any solution..
> All I am trying to do is to embed a XML String in a SOAP response..
> that is in my registered SOAP  service I want to return a XML String.
> Which I am constructing ..using the JDOM APIs
> But I want to remove the version,encoding info from that since it is
already
> embedded inside the SOAP XML...
> Ex:
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP Envelope>
> .....
> <response>
> <myname>Naggi</myname>
> <urname>Joe</urname>
> </response>
> .....
> </SOAP Envelope>
> BUT THE JDOM PARSER ADDS A
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP Envelope>
> .....
> <!--aDDED BY THE jdom STUFF which I want to remove
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <myname>Naggi</myname>
> <urname>Joe</urname>
> </response>
> .....
> </SOAP Envelope>
>
>
> How could I remove it ???
> I have "graduated" from SAX so my knowledge about JDOM and DOM is limited
!!
> PLEASE help me if u can !!
>
> Cheers,
> Naggi
>
>


Re: A Simple XML Question ..but I am stuck !

Posted by Naggi Rao <na...@softhome.net>.
True,
But using Literal XML Encoding micght serve as a "cheap" solution for me...
Since My response consists of pure XML and HTML enclosed in a CDATA
section...

Naggi

----- Original Message -----
From: "Kartheek Hirode" <ka...@centegy.com>
To: <so...@xml.apache.org>
Sent: Tuesday, May 01, 2001 2:28 PM
Subject: RE: A Simple XML Question ..but I am stuck !


> I guess this is sortof like being stuck between a rock and a hard place.
> There is no one economical way of sending XML payloads within SOAP. We use
> Base64 encoding to hide the XML prolog and this works ok since payload
sizes
> are not too big. I will sit down now and compare payload sizes of
> LiteralXml-encoded and base64 encoded messages for the same payload.
> Of course, using LiteralXML encoding precludes any other type of payload
> format (such as plain text, HTML etc), but that might not be a
consideration
> for everyone.
> --KH
>
> -----Original Message-----
> From: Scott Nichol [mailto:snichol@computer.org]
> Sent: Tuesday, May 01, 2001 8:00 AM
> To: soap-dev@xml.apache.org
> Subject: Re: A Simple XML Question ..but I am stuck !
>
>
> > The other approach you could use is to serialize the RootElement using
the
> > "LiteralXML" encoding
> > that Apache-SOAP provides, but this too is a resource hog for big XML
> > payloads.
>
> I am curious, is there a way to serialize "big XML payloads" that is not a
> "resource
> hog"?  Without looking at the code, I would have guessed that literal XML
> would be a
> pretty good way to send a large piece of XML.
>
> Scott
>
>


RE: A Simple XML Question ..but I am stuck !

Posted by Kartheek Hirode <ka...@centegy.com>.
I guess this is sortof like being stuck between a rock and a hard place.
There is no one economical way of sending XML payloads within SOAP. We use
Base64 encoding to hide the XML prolog and this works ok since payload sizes
are not too big. I will sit down now and compare payload sizes of
LiteralXml-encoded and base64 encoded messages for the same payload.
Of course, using LiteralXML encoding precludes any other type of payload
format (such as plain text, HTML etc), but that might not be a consideration
for everyone.
--KH

-----Original Message-----
From: Scott Nichol [mailto:snichol@computer.org]
Sent: Tuesday, May 01, 2001 8:00 AM
To: soap-dev@xml.apache.org
Subject: Re: A Simple XML Question ..but I am stuck !


> The other approach you could use is to serialize the RootElement using the
> "LiteralXML" encoding
> that Apache-SOAP provides, but this too is a resource hog for big XML
> payloads.

I am curious, is there a way to serialize "big XML payloads" that is not a
"resource
hog"?  Without looking at the code, I would have guessed that literal XML
would be a
pretty good way to send a large piece of XML.

Scott


Re: A Simple XML Question ..but I am stuck !

Posted by Scott Nichol <sn...@computer.org>.
> The other approach you could use is to serialize the RootElement using the
> "LiteralXML" encoding
> that Apache-SOAP provides, but this too is a resource hog for big XML
> payloads.

I am curious, is there a way to serialize "big XML payloads" that is not a "resource
hog"?  Without looking at the code, I would have guessed that literal XML would be a
pretty good way to send a large piece of XML.

Scott



RE: A Simple XML Question ..but I am stuck !

Posted by Kartheek Hirode <ka...@centegy.com>.
When you output an XMLDocument from JDOM, it mandatorily puts the XML prolog
(<?xml...> in the output string. So, I don't think there is a way around it
other than doing the cleaning manually (which is kludgey).
Your problem is the classical "XML payloads thru' SOAP" issue. SOAP (and
Apache-SOAP) till now has maintained independance (thereby, lack of support)
from payload formatss and hence XML payloads are the developer's onus to
handle. You could Base64 encode the payload to hide the XML prolog and SOAP
will not complain. (Base64, however, adds to the size of the packet...up
30%)

The other approach you could use is to serialize the RootElement using the
"LiteralXML" encoding
that Apache-SOAP provides, but this too is a resource hog for big XML
payloads.
--KH


-----Original Message-----
From: Naggi Rao [mailto:naggi@softhome.net]
Sent: Monday, April 30, 2001 3:22 PM
To: soap-dev@xml.apache.org
Subject: A Simple XML Question ..but I am stuck !


Hi all,
Please excuse me for posing such a simple question in this list.But I am
stuck and I dont seem to have any solution..
All I am trying to do is to embed a XML String in a SOAP response..
that is in my registered SOAP  service I want to return a XML String.
Which I am constructing ..using the JDOM APIs
But I want to remove the version,encoding info from that since it is already
embedded inside the SOAP XML...
Ex:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP Envelope>
.....
<response>
<myname>Naggi</myname>
<urname>Joe</urname>
</response>
.....
</SOAP Envelope>
BUT THE JDOM PARSER ADDS A

<?xml version="1.0" encoding="UTF-8"?>
<SOAP Envelope>
.....
<!--aDDED BY THE jdom STUFF which I want to remove
!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<?xml version="1.0" encoding="UTF-8"?>
<response>
<myname>Naggi</myname>
<urname>Joe</urname>
</response>
.....
</SOAP Envelope>


How could I remove it ???
I have "graduated" from SAX so my knowledge about JDOM and DOM is limited !!
PLEASE help me if u can !!

Cheers,
Naggi