Parameters aren't tranfered to the webservice

P

Pernille

Hi,

I have a problem transfurring the parametres from my perl client
program to the webservice. I have another clientprogram in C# where
there is no problem so it cant be the webservice which is wrong.

The connection to the service is ok, but if I try to call the
Webmethod with the parametres from the client and return the
parametervalues from the webservice, they are always set to default,
zero if it's an int or " " if its a string.

Perl Client:
_______________________________________________________________________________

#!/local/perl/eg

# hello.pl

use WebService::ServiceProxy;

my $wsdl = "http://localhost/DmuCheckOutService/Service1.asmx?WSDL";
my $service = WebService::ServiceProxy->new($wsdl);

print "Which funktion do you want to access?\n A: Check Out DMU\n ";

$name = <STDIN>;

if ($name =~ "a")
{
print "Check Out Dmu:\n Enter DMU id: ";
$dmuid = <STDIN>;
print $service->Test($dmuid);
}
________________________________________________________________________________

Webservice:
________________________________________________________________________________

[WebMethod]
public string Test(int id)
{
return "id : "+id;
}

________________________________________________________________________________

Even if I hardcode the id in the client as: "Test(2); " it returns 0.

Can enyone tell me what I am doing wrong??

Thanks

Pernille
 
P

Pernille

I solved the problem myself by using this code:

use SOAP::Lite;

my $soap = SOAP::Lite
-> uri('http://kpmdev.newtech.dk')
-> on_action( sub { join '/', 'http://kpmdev.newtech.dk', $_[1] } )
-> proxy('http://kpmdev.newtech.dk/kpmwebservice/Service1.asmx');

print "Check Out Dmu:\n Enter DMU id: ";
$dmuid = <STDIN>;
print " Enter User Id: ";
$userid = <STDIN>;
my $method = SOAP::Data->name('CheckoutDMU')
->attr({xmlns => 'http://kpmdev.newtech.dk'});

my @params = ( SOAP::Data->name(dmuautoid => $dmuid),
SOAP::Data->name(userid => $userid) );

print $soap->call($method => @params)->result;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top