SOAP::Lite serialisation differences between 0.60 and 0.69

Ian Malpass ian at indecorous.com
Thu Jul 12 18:18:15 BST 2007


I'm using MantisConnect[0] to connect my code to the Mantis bug-tracking
system[1]. The code I wrote works with 0.60, but fails with anything
newer, and I don't know why. I've looked in the changelog but nothing
obvious appeared.

I have, in the past, built complex data structures by using bless. I'm
assuming this isn't the right way to do things, but it works (or used
to) and it's a lot simpler than mucking with SOAP::Data and friends.

Below is a script that illustrates my approach and suffers from the
problem. (Apologies for the ugliness of the transport sub - I lost the
will to make it pretty.) The 'ObjectRef' blessed refs come from previous
method calls to extract data from Mantis, also using MantisConnect. The
WSDL file can be seen at
<http://www.futureware.biz/mantis/mc/mantisconnect.php?wsdl>.

I've also added the HTTP::Request that gets sent for 0.60 and 0.69. In
0.60, the request includes serialised data for the IssueData object as
expected. In 0.69, I get

     <issue xsi:nil="true" xsi:type="tns:IssueData" />

Any help, insight, pointers, etc. would be greatly appreciated.

Thanks,

Ian

----

# SOAP::Lite example script
use strict;
use warnings;
use Data::Dumper;
use SOAP::Lite ( +trace => [ transport => sub {
	my $msg = Dumper $_[0];
         $msg =~ s|<|\n<|g;
         $msg =~ s|>|>\n|g;
         $msg =~ s|=>\n|=>|g;
         $msg =~ s|\n\n|\n|g;
         print STDERR "$msg\n------\n";
} ] );

my $issue = bless( {
     'priority' => bless(
         { 'name' => 'none', 'id' => '10' }, 'ObjectRef'
     ),
     'additional_information' => 'some additonal info',
     'project' => bless(
         { 'name' => 'Example', 'id' => '1', }, 'ObjectRef'
     ),
     'description' => 'a description',
     'summary' => 'a summary',
     'view_state' => bless(
         { 'name' => 'public', 'id' => '10' }, 'ObjectRef'
     ),
     'category' => 'Category A',
     'reproducibility' => bless(
         { 'name' => 'always', 'id' => '10' }, 'ObjectRef'
     ),
     'severity' => bless(
         { 'name' => 'feature', 'id' => '10' }, 'ObjectRef'
     )
}, 'IssueData' );

my $soap = SOAP::Lite
         ->service( 'http://localhost/mantis/mc/mantisconnect.php?wsdl' )
         ->xmlschema( 'http://www.w3.org/2001/XMLSchema' );
$issue = $soap->mc_issue_add( 'administrator', 'root', $issue );

----

# SOAP Lite 0.60

$VAR1 = bless( {
                  '_protocol' => 'HTTP/1.1',
                  '_content' => '
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:namesp2="http://namespaces.soaplite.com/perl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<namesp1:mc_issue_add xmlns:namesp1="http://futureware.biz/mantisconnect">
<username xsi:type="xsd:string">
administrator
</username>
<password xsi:type="xsd:string">
root
</password>
<issue xsi:type="tns:IssueData">
<priority xsi:type="namesp2:ObjectRef">
<name xsi:type="xsd:string">
none
</name>
<id xsi:type="xsd:int">
10
</id>
</priority>
<additional_information xsi:type="xsd:string">
additonal info
</additional_information>
<project xsi:type="namesp2:ObjectRef">
<name xsi:type="xsd:string">
ATM
</name>
<id xsi:type="xsd:int">
1
</id>
</project>
<description xsi:type="xsd:string">
desc
</description>
<summary xsi:type="xsd:string">
sdfsdfd
</summary>
<view_state xsi:type="namesp2:ObjectRef">
<name xsi:type="xsd:string">
public
</name>
<id xsi:type="xsd:int">
10
</id>
</view_state>
<category xsi:type="xsd:string">
Category A
</category>
<reproducibility xsi:type="namesp2:ObjectRef">
<name xsi:type="xsd:string">
always
</name>
<id xsi:type="xsd:int">
10
</id>
</reproducibility>
<severity xsi:type="namesp2:ObjectRef">
<name xsi:type="xsd:string">
feature
</name>
<id xsi:type="xsd:int">
10
</id>
</severity>
</issue>
</namesp1:mc_issue_add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
',
                  '_uri' => bless( do{\(my $o =
'http://localhost/mantis/mc/mantisconnect.php')}, 'URI::http' ),
                  '_headers' => bless( {
                                         'soapaction' =>
'"http://localhost/mantis/mc/mantisconnect.php/mc_issue_add"',
                                         'content-type' => 'text/xml;
charset=utf-8',
                                         'accept' => [
                                                       'text/xml',
                                                       'multipart/*'
                                                     ],
                                         'content-length' => 1539
                                       }, 'HTTP::Headers' ),
                  '_method' => 'POST'
                }, 'HTTP::Request' );

----

# SOAP::Lite 0.69

$VAR1 = bless( {
                  '_protocol' => 'HTTP/1.1',
                  '_content' => '
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:si="http://soapinterop.org/xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://futureware.biz/mantisconnect"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<tns:mc_issue_add>
<username xsi:type="xsd:string">
administrator
</username>
<password xsi:type="xsd:string">
root
</password>
<issue xsi:nil="true" xsi:type="tns:IssueData" />
</tns:mc_issue_add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
',
                  '_uri' => bless( do{\(my $o =
'http://persephone/mantis/mc/mantisconnect.php')}, 'URI::http' ),
                  '_headers' => bless( {
                                         'soapaction' =>
'"http://persephone/mantis/mc/mantisconnect.php/mc_issue_add"',
                                         'content-type' => 'text/xml;
charset=utf-8',
                                         'accept' => [
                                                       'text/xml',
                                                       'multipart/*',
                                                       'application/soap'
                                                     ],
                                         'content-length' => 764
                                       }, 'HTTP::Headers' ),
                  '_method' => 'POST'
                }, 'HTTP::Request' );

----

[0] <http://www.futureware.biz/mantisconnect/>
[1] <http://www.mantisbt.org/>



More information about the london.pm mailing list