Hi,
I'm trying to get a array and hash value from one SOAP Web Services Server without success.
When try to get a hash, I receive 'Odd number of elements in hash assignment at C:\Temp\SOAP\client.pl line 9.' message, or just 1 element from a array variable with no message.
Looking at the dump (after turn on trace on client) I could see all elements of array and hash received from server. Because this maybe I must have to turn on something on client to get the correct values.
My codes are bellow, and I'd like your help to show me where are my bugs.
# Server system
# This is a test of one Web Service Server
use strict;
use SOAP::Transport::HTTP;
use Demo;
my $port = 8080;
my $host = 'localhost';
SOAP::Transport::HTTP::Daemon
->new(LocalAddr => $host, LocalPort => $port, Reuse => 1)
->dispatch_with({ 'urn:Demo' => 'Demo' })
->objects_by_reference('Demo')
->handle;
exit;
# The package demo !
package Demo;
use subs qw( Sub1 Sub2 );
sub Sub1
{
my %Test= ( 'Test01' => 1,
'Test02' => 1,
'Test99' => 1 );
return %Test;
}
sub Sub2
{
my @Test = qw (2 3 4 5 6 7 8 9 10);
return @Test;
}
1;
# Client side
use SOAP::Lite;
my $endpoint = shift || 'http://localhost:8080';
my $soap = SOAP::Lite->uri('urn:Demo')
->proxy($endpoint);
my %Test = $soap->Sub1()->result;
foreach my $Key01 ( keys %Test )
{
print "Key : $Key01\n";
}
Thanks all.
Solli Moreira Honorio
Sao Paulo - Brazil
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.