« Version numbers, they are a change'n | Main | An improved HTTP Daemon? »

Comments

Kori MacCara

Just an FYI in case anyone is working with SOAP::Lite 0.60a or 0.55 in a stable production environment and haven't yet updated to 0.65.

I wrote a SOAP client that needed access to the raw XML of a response and I wanted to retain access to the deserialized hash objects - to do this I wrote my own deserializer which derived from the SOAP::Deserializer object - it's pretty simple:

package SOAP::MyDeserializer;

BEGIN
{
use SOAP::Lite;
use vars qw($VERSION);
use base SOAP::Deserializer;

$VERSION = "1.0";
}

sub new {
my $self = shift;
my $class = ref($self) || $self;
return $self if ref $self;

# We are still a SOAP::Deserializer...
my $base_object = $class->SUPER::new();

# With a little extra flavour.
$base_object->{_raw_xml} = undef;

return bless ($base_object, $class);
}

# This method takes the raw SOAP response as
# it's only argument.. so we store it - so we
# can get at it later.
sub deserialize {
my $this = shift @_;
$this->{_raw_xml} = $_[0];
return $this->SUPER::deserialize(@_);
}

# Get the SOAP response in XML form.
sub getResponseXML {
my $this = shift @_;
return $this->{_raw_xml};
}


To make my SOAP call I used the SOAP::MyDeserializer instead of the default one used by SOAP::Lite. I had access to the deserialized hash objects through SOAP::SOM and to the raw XML through SOAP::MyDeserializer.

Not sure if that will help anyone else out - you can do a similar thing to get access to the request by writing your own SOAP::Serializer.

The comments to this entry are closed.