You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Erwin Burgstaller <be...@knapp.com> on 2002/03/14 18:03:48 UTC

Cocoon2, SOAP: How to process xml-content?

I have a SOAP service which produces well formed xml-content. I want to
get data from that service into a cocoon xsp application. At the moment
the result looks like this:

[..]

<SOAP-ENV:Body>
<namesp3:list_allResponse xmlns:namesp3="urn:Stlist">
<s-gensym15 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
&lt;times&gt;
&lt;sdate&gt;2002.01.07&lt;/sdate&gt;&lt;stime&gt;07:58:59&lt;/stime&gt;&lt;edate&gt;2002.01.07&lt;/edate&gt;&lt;etime&gt;12:01:49&lt;/etime&gt;&lt;project&gt;0099&lt;/project&gt;&lt;brgroup&gt;06&lt;/bgroup&gt;&lt;comment&gt;209

[..]

This is without processing any stylesheet.

My question is: How can I prohibit the xml-code to be converted to
text, or how can transform it back to xml to be processed by a
stylesheet later. The intention is to handle it like files with "xinclude".

Thanks,
	Erwin

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon2, SOAP: How to process xml-content?

Posted by Pawel Luszynski <pa...@pi.net.pl>.
----- Original Message -----
From: "Erwin Burgstaller" <be...@knapp.com>
To: <co...@xml.apache.org>
Sent: Thursday, March 14, 2002 6:03 PM
Subject: Cocoon2, SOAP: How to process xml-content?


>
> I have a SOAP service which produces well formed xml-content. I want to
> get data from that service into a cocoon xsp application. At the moment
> the result looks like this:
>
> [..]
>
> <SOAP-ENV:Body>
> <namesp3:list_allResponse xmlns:namesp3="urn:Stlist">
> <s-gensym15 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
> &lt;times&gt;
>
&lt;sdate&gt;2002.01.07&lt;/sdate&gt;&lt;stime&gt;07:58:59&lt;/stime&gt;&lt;
edate&gt;2002.01.07&lt;/edate&gt;&lt;etime&gt;12:01:49&lt;/etime&gt;&lt;proj
ect&gt;0099&lt;/project&gt;&lt;brgroup&gt;06&lt;/bgroup&gt;&lt;comment&gt;20
9
>
> [..]
>
> This is without processing any stylesheet.
>
> My question is: How can I prohibit the xml-code to be converted to
> text, or how can transform it back to xml to be processed by a
> stylesheet later. The intention is to handle it like files with
"xinclude".
>
> Thanks,
> Erwin
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon2, SOAP: How to process xml-content?

Posted by Erwin Burgstaller <be...@knapp.com>.
On Fri, Mar 15, 2002 at 09:19:26AM -0500, William Brogden wrote:
>  Your SOAP server appears to be converting XML tags to escaped form, 
> but thats exactly what you don't want. How is the data originally 
> stored, with real tags or in the escaped form.

With real tags. Actually it's just a test module at the moment. But I've
found a solution right now.

Starting with the example:
http://cookbook.soaplite.com/#overriding%20serializer%20(server)

I wrote:

#----------------
package MySOAP;

use strict;
use vars qw(@ISA $VERSION);
use SOAP::Transport::HTTP;
use MySerializer;

@ISA = qw(SOAP::Transport::HTTP::Apache);
$VERSION = eval sprintf("%d.%s", q$Name: release-0_52-public $ =~
/-(\d+)_([\d_]+)/);

my $server = __PACKAGE__
    -> new
    -> serializer(MySerializer->new
         -> autotype(0));

sub handler {
  $server->configure(@_);
  $server->SUPER::handler(@_);
}

1;
#----------

(I know, this is a big security hole, it will be secured next)
and:

#----------
package MySerializer; 

@MySerializer::ISA = 'SOAP::Serializer';

sub envelope {
    $_[2] = SOAP::Data->name($_[2])
    ->encodingStyle("http://xml.apache.org/xml-soap/literalxml")
    if $_[1] =~ /^(?:method|response)$/;
    shift->SUPER::envelope(@_);
}


1;
#----------


So the last trick was to create a new serializer with autotype(FALSE).

Now I have (with no transformer):

<SOAP-ENV:Envelope
 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<list_allResponse
 SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
<s-gensym2>
<times>
<sdate>2002.01.07</sdate>
<stime>07:58:59</stime>
<edate>2002.01.07</edate>
<etime>12:01:49</etime>
<project>0099</project>
<bgroup>06</bgroup>
<comment>209
</comment>
</times>

[.. a lot more records ..]

</s-gensym2>
</list_allResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I don't know, if this is completely correct, but it does now exactly
what I want. Thanks William, you brought me to the right direction.

Erwin

PS.:

For completeness, this is the part of the apache configuration for the
service: 

<Location /mod_soap>
 SetHandler perl-script
 PerlHandler MySOAP
 PerlSetVar dispatch_to "/usr/local/lib/site_perl,
 /usr/share/perl/5.6.1, /usr/share/perl5, /usr/lib/perl5,
 /usr/lib/perl/5.6.1, Module::Name, Module::method"
 PerlSetVar options "compress_threshold => 10000"
</Location>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Cocoon2, SOAP: How to process xml-content?

Posted by William Brogden <wb...@bga.com>.
> -----Original Message-----
> From: Erwin Burgstaller [mailto:burgstal@knapp.com] On Behalf 
> Of Erwin Burgstaller
> Sent: Friday, March 15, 2002 8:47 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: Cocoon2, SOAP: How to process xml-content?
> 
> 
> On Fri, Mar 15, 2002 at 08:01:32AM +0100, Erwin Burgstaller wrote:
> > Apache::SOAP. So I hope I will find how to configure the service to
> > return an org.w3c.dom.Element, will I?
> 
> Ok, I've got the service to write:
> 
> [..]
> <SOAP-ENV:Body>
> <list_allResponse
> SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
> <s-gensym12 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
> [..]
> 
> But that does not change anything.

 Your SOAP server appears to be converting XML tags to escaped form, 
but thats exactly what you don't want. How is the data originally 
stored, with real tags or in the escaped form.

WBB



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon2, SOAP: How to process xml-content?

Posted by Erwin Burgstaller <be...@knapp.com>.
On Fri, Mar 15, 2002 at 08:01:32AM +0100, Erwin Burgstaller wrote:
> Apache::SOAP. So I hope I will find how to configure the service to
> return an org.w3c.dom.Element, will I?

Ok, I've got the service to write:

[..]
<SOAP-ENV:Body>
<list_allResponse
SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
<s-gensym12 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
[..]

But that does not change anything.

Let me ask another question: Is it possible to get the output of a
function handled as xml?

For example:

-------
[..]

<xsp:logic>
	private String hello() {
	  return "&lt;result&gt;Hello&lt/result&gt;";
        }
</xsp:logic>

[..]

<xsp:expr>hello()</xsp:expr>
-------

Will result the text node handled to the next transformer as it is shown
in the function and not as: <result>Hello</result> while the generated
java code looks like: return "<result>Hello</result>".

Erwin


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon2, SOAP: How to process xml-content?

Posted by Erwin Burgstaller <be...@knapp.com>.
On Thu, Mar 14, 2002 at 01:34:38PM -0500, William Brogden wrote:
> Why not have the service return a org.w3c.dom.Element -
> that will produce xml directly in the SOAP response.
> 
> Your deployment descriptor would have an entry like this example I ran:
> 
>  <isd:mappings>
>    <isd:map encodingStyle="http://xml.apache.org/xml-soap/literalxml"
>      xmlns:x="urn:ExercisePubs" qname="x:book-element"
>      javaType="org.w3c.dom.Element"
>      java2XMLClassName=
>        "org.apache.soap.encoding.literalxml.XMLParameterSerializer"
>      xml2JavaClassName=
>        "org.apache.soap.encoding.literalxml.XMLParameterSerializer"
>      />
> </isd:mappings>

I don't have Java on the server. The soap service is made with Perl and
Apache::SOAP. So I hope I will find how to configure the service to
return an org.w3c.dom.Element, will I?

Erwin
 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Cocoon2, SOAP: How to process xml-content?

Posted by William Brogden <wb...@bga.com>.
> -----Original Message-----
> From: Erwin Burgstaller [mailto:burgstal@knapp.com] On Behalf 
> Of Erwin Burgstaller
> Sent: Thursday, March 14, 2002 12:04 PM
> To: cocoon-users@xml.apache.org
> Subject: Cocoon2, SOAP: How to process xml-content?
> 
> 
> 
> I have a SOAP service which produces well formed xml-content. 
> I want to
> get data from that service into a cocoon xsp application. At 
> the moment
> the result looks like this:
> 
> [..]
> 
> <SOAP-ENV:Body>
> <namesp3:list_allResponse xmlns:namesp3="urn:Stlist">
> <s-gensym15 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
> &lt;times&gt;
> &lt;sdate&gt;2002.01.07&lt;/sdate&gt;&lt;stime&gt;07:58:59&lt;
> /stime&gt;&lt;edate&gt;2002.01.07&lt;/edate&gt;&lt;etime&gt;12
> :01:49&lt;/etime&gt;&lt;project&gt;0099&lt;/project&gt;&lt;brg
> roup&gt;06&lt;/bgroup&gt;&lt;comment&gt;209
> 
> [..]
> 
> This is without processing any stylesheet.
> 
> My question is: How can I prohibit the xml-code to be converted to
> text, or how can transform it back to xml to be processed by a
> stylesheet later. The intention is to handle it like files 
> with "xinclude".
> 
> Thanks,
> 	Erwin

Why not have the service return a org.w3c.dom.Element -
that will produce xml directly in the SOAP response.

Your deployment descriptor would have an entry like this example I ran:

 <isd:mappings>
   <isd:map encodingStyle="http://xml.apache.org/xml-soap/literalxml"
     xmlns:x="urn:ExercisePubs" qname="x:book-element"
     javaType="org.w3c.dom.Element"
     java2XMLClassName=
       "org.apache.soap.encoding.literalxml.XMLParameterSerializer"
     xml2JavaClassName=
       "org.apache.soap.encoding.literalxml.XMLParameterSerializer"
     />
</isd:mappings>

wbrogden@bga.com
Author of Soap Programming with Java - Sybex; ISBN: 0782129285





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>