[Xml-compile] Is XML::Compile the right tool for writing a
SOAP server?
Mark Overmeer
mark at overmeer.net
Mon Mar 23 15:39:47 GMT 2009
* Petar Shangov (pshangov at yahoo.com) [090323 12:49]:
> XML::Compile::SOAP 2.02, released 2009-02-23
> XML::Compile::SOAP::Daemon 2.01, released 2009-02-23
>
> excerpt from my daemon script:
>
> my $daemon = XML::Compile::SOAP::HTTPDaemon->new;
> my $wsdl = XML::Compile::WSDL11->new("path/to/tm.wsdl");
>
> my %callbacks = (get_set => \&TM::WebServices::get_set);
> $daemon->operationsFromWSDL($wsdl, callbacks => \%callbacks);
>
> $daemon->run( ...);
>
> running the script dies with:
>
> panic: cannot handle type parameter in server filter
True... the server does not understand RPC(-literal) yet.
The problem is that SOAP does not have a clean way to discover what
the actual portType was. It sounds weird... but it is true: from the
encoded body, you have to find back the message where it refers to,
and hope that there is only a single match.
So, the compileFilter() rule tries to detect whether the the found
body element matches the choice for that body. When the body is
defined by an element, that is simpler than when it is defined
by a type. The latter not being very complicated either... just
a matter of data-flow.
We should try something like this: (XML/Compile/SOAP/Server.pm)
sub compileFilter(@)
{ my ($self, %args) = @_;
my $nodetype;
if(my $first = $args{body}{parts}[0])
- { $nodetype = $first->{element}
- or panic "cannot handle type parameter in server filter";
+ { nodetype = $first->{element}
+ || $args->{body}{procedure};
}
# called with (XML, INFO)
defined $nodetype
? sub { my $f = $_[1]->{body}[0]; defined $f && $f eq $nodetype }
: sub { !defined $_[1]->{body}[0] }; # empty body
}
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list