|
From: Jason S. <jas...@gm...> - 2008-09-12 03:25:35
|
Hey Martin,
On Fri, Sep 12, 2008 at 1:49 AM, Martin Kutter <mar...@fe...> wrote:
> Hi Jason,
>
> 1) throwing away attributes sounds like a bug to me.
Here is my client:
#!/usr/bin/perl -w
use strict;
use SOAP::Lite; my $soap = SOAP::Lite->new( proxy =>
'http://localhost:80/cgi-bin/doc-lit-server-test.pl');
$soap->on_action( sub { "urn:HelloWorld#sayHello" });
$soap->autotype(0);
$soap->default_ns('urn:HelloWorld');
my $som = $soap->call("sayHello",
SOAP::Data->name('name')
->value( 'Kutter' ),
SOAP::Data->name('givenName')
->value('Martin')
->attr({middleName=>'windy'}),
);
die $som->fault->{ faultstring } if ($som->fault);
print $som->result, "\n";
Here is the server:
#!/usr/bin/perl -w
use strict;
use SOAP::Transport::HTTP;
my $server = new SOAP::Transport::HTTP::CGI;
$server->dispatch_to('HelloWorld')
->handle;
BEGIN {
package HelloWorld;
use SOAP::Lite;
use Data::Dumper;
use base qw(SOAP::Server::Parameters);
sub sayHello {
my $self = shift;
my $som = pop;
warn "Argument Check: ", Dumper($som);
my $body = $som->dataof('//Body');
warn "Body Check: ", Dumper($body);
SOAP::Data->name('sayHelloResult')->value($body);
}
}
Here is the output in the log file for the two warns:
(I've just taken the _content key from the SOM object)
'_content' => [
'soap:Envelope',
{
'xmlns:soapenc' => 'http://schemas.xmlsoap.org/soap/encoding/',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/',
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
},
[
[
'soap:Body',
{},
[
[
'sayHello',
{
'xmlns' => 'urn:HelloWorld'
},
[
[
'name',
{},
'Kutter',
undef,
'Kutter',
'{urn:HelloWorld}name',
{}
],
[
'givenName',
{
'middleName' => 'windy'
},
'Martin',
undef,
'Martin',
'{urn:HelloWorld}givenName',
{
'middleName' => 'windy'
}
]
],
undef,
{
'name' => 'Kutter',
'givenName' => 'Martin'
},
'{urn:HelloWorld}sayHello',
{}
]
],
undef,
{
'sayHello' => $VAR1->{'_content'}[2][0][2][0][4]
},
'{http://schemas.xmlsoap.org/soap/envelope/}Body',
{}
]
],
and here is the output of dataof():
Body Check: $VAR1 = bless( {
'_name' => 'Body',
'_uri' => 'http://schemas.xmlsoap.org/soap/envelope/',
'_signature' => [],
'_value' => [
{
'sayHello' => {
'name' => 'Kutter',
'givenName' => 'Martin'
}
}
],
'_prefix' => 'soap',
'_attr' => {}
}, 'SOAP::Data' );
So dataof() is throwing away all the attributes on the sub-elements of
Body. This seems bad to me, and it seems unintended according to
Martin. So I will look to see why this is happening.
Cheers, jas.
|