Here's my (very) custom serializer:
And the resulting response XML:package MySerializer; @MySerializer::ISA = 'SOAP::Serializer'; sub envelope { my $self = shift; my $type = shift; if ($type =~ /^response$/ && $_[0] eq 'CheckResponse') { $_[0] = SOAP::Data->name($_[0])->prefix(''); $_[1] = SOAP::Data->value( SOAP::Data->name(text => $_[1]->{text}), SOAP::Data->name(severity => $_[1]->{severity}), SOAP::Data->name(error => $_[1]->{error}), ); } $self->SUPER::envelope($type, @_); }
Which is quite close to what the .net client expects.<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc +e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S +OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/ +/www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xm +lsoap.org/soap/encoding/"> <SOAP-ENV:Body> <CheckResponse> <text xsi:type="xsd:string">Valid Domain</text> <severity xsi:type="xsd:int">0</severity> <error xsi:type="xsd:int">0</error> </CheckResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
The only problem with that solution is that the serializer has to be modified if the Check() method changes, and any other method exposed via SOAP::Lite will need a custom serializer to achieve the same compatibility.
Is it possible to write the serializer in a more generic way? I haven't found anything in all the SOAP::Lite articles I read on the web, nor in the code for SOAP::Serializer (which I found rather hard to follow!)
Cheers,
theblop.
In reply to Re^2: .net-friendly soap messages with Apache::SOAP
by theblop
in thread .net-friendly soap messages with Apache::SOAP
by theblop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |