cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erwin Burgstaller <...@knapp.com>
Subject Re: Cocoon2, SOAP: How to process xml-content?
Date Mon, 18 Mar 2002 10:48:47 GMT
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message