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. |
From: Jason S. <jas...@gm...> - 2008-09-12 04:40:06
|
Hey Martin, I dug a bit deeper. I see that the search methods are all working fine. The methods are create SOAP::Data objects and setting the value using set_value(o_value($pointer)) and o_value is defined as: sub o_value { $_[0]->[4] } Here is the value of $pointer: 0 ARRAY(0x87a7e08) 0 'soap:Body' 1 HASH(0x879e348) empty hash 2 ARRAY(0x87a7bc8) 0 ARRAY(0x879eeac) 0 'sayHello' 1 HASH(0x879e3c0) 'xmlns' => 'urn:HelloWorld' 2 ARRAY(0x879ebdc) 0 ARRAY(0x879e588) 0 'name' 1 HASH(0x879e480) empty hash 2 'Kutter' 3 undef 4 'Kutter' 5 '{urn:HelloWorld}name' 6 HASH(0x879e4f8) empty hash 1 ARRAY(0x879e918) 0 'givenName' 1 HASH(0x879e7b0) 'middleName' => 'windy' 2 'Martin' 3 undef 4 'Martin' 5 '{urn:HelloWorld}givenName' 6 HASH(0x879e858) 'middleName' => 'windy' 3 undef 4 HASH(0x879ecfc) 'givenName' => 'Martin' 'name' => 'Kutter' 5 '{urn:HelloWorld}sayHello' 6 HASH(0x879ee1c) empty hash 3 undef 4 HASH(0x87a7c88) 'sayHello' => HASH(0x84dc224) 'givenName' => 'Martin' 'name' => 'Kutter' 5 '{http://schemas.xmlsoap.org/soap/envelope/}Body' 6 HASH(0x87a7d78) empty hash Looking at the item at index 4 we cans see the hash representation has been stripped of all it's attributes. So.... Either these methods should not be doing set_value(o_value($pointer)), Or, the thing at index 4 is being constructed incorrectly for the SOM object. Cheers, jas. |