You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by John Heim <jh...@wiscmail.wisc.edu> on 2004/07/20 22:27:49 UTC
Calling axis stock quote example from perl
I went all the way through the axis installation instructions at
http://ws.apache.org/axis/java/install.html. I was able to run the stock
quote demo and got back the correct result (55.25). If I go to
http://localhost:8080/axis/servlet/AxisServlet, I get a page that says,
"And now some services" and I can see the services listed there including
the following:
* urn:xmltoday-delayed-quotes (wsdl)
* test
* getQuote
now, however, I want to call it from perl. But I can't get it to return
anything. My code is below. Is there some place where they document how to
call this service?
#!/usr/bin/perl
use SOAP::Lite;
print "The SOAP Server says: ";
print SOAP::Lite
-> uri('urn:xmltoday-delayed-quotes')
-> proxy('http://localhost:8080/axis/servlet/AxisServlet')
-> getQuote('user1', 'XXX')
-> result . "\n\n";
--
John G. Heim
University of Wisconsin - Division of Information Technology (DoIT)
1210 West Dayton St, #4297, Phone: 2-9887
To boldly code what no one has coded before.
Re: Calling axis stock quote example from perl
Posted by John Heim <jh...@wiscmail.wisc.edu>.
At 10:47 AM 7/21/2004, Scott Nichol you wrote:
>I believe that the 'XXX' is the only parameter to the call. The username
>and password that are supplied on the command line are for HTTP
>authentication, I think. I am not sure how SOAP::Lite does HTTP
>authentication. In a quick look at the SOAP::Lite docs, I did not find
>anything.
Good tips. Thanks. I was hearing the -wpass1 and thinking (in perl) that
that whole thing was a command line parameter called wpass and it's value
was XXX. Kind of dumb but as I mentioned last week, I'm blind and I have to
listen to the instructions.
Anyway, I got it working. The code is below. Note the sub at the end that
overwrites the existing SOAP::Lite sub and returns the
proper credentials...
#!/usr/bin/perl
use SOAP::Lite;
my $lite = SOAP::Lite->new;
$response = $lite->proxy('http://localhost:8080/axis/servlet/AxisServlet')
-> uri('urn:xmltoday-delayed-quotes')
-> getQuote('XXX');
print "[" . $response->result . "]\n";
die "Fault: ".$response->faultcode." ".$response->faultdetail."
".$response->faultstring if $response->faultcode;
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{ return 'user1' => 'pass1'; }
Re: Calling axis stock quote example from perl
Posted by Scott Nichol <sn...@scottnichol.com>.
I believe that the 'XXX' is the only parameter to the call. The username and password that are supplied on the command line are for HTTP authentication, I think. I am not sure how SOAP::Lite does HTTP authentication. In a quick look at the SOAP::Lite docs, I did not find anything.
Further, it may be that the getQuote method must be prefixed by the namespace used for the URI. The SOAP::Lite docs seem to show an example of this
print SOAP::Lite
-> new(....)
-> call('myprefix:method' => @parameters)
-> result;
Whether "myprefix" is supposed to the the actual namespace or some prefix you make up, I do not know. I would guess that the prefix must be the namespace itself.
Scott Nichol
Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "John Heim" <jh...@wiscmail.wisc.edu>
To: <so...@ws.apache.org>
Sent: Tuesday, July 20, 2004 4:27 PM
Subject: Calling axis stock quote example from perl
>
>
> I went all the way through the axis installation instructions at
> http://ws.apache.org/axis/java/install.html. I was able to run the stock
> quote demo and got back the correct result (55.25). If I go to
> http://localhost:8080/axis/servlet/AxisServlet, I get a page that says,
> "And now some services" and I can see the services listed there including
> the following:
>
> * urn:xmltoday-delayed-quotes (wsdl)
> * test
> * getQuote
>
>
> now, however, I want to call it from perl. But I can't get it to return
> anything. My code is below. Is there some place where they document how to
> call this service?
>
> #!/usr/bin/perl
> use SOAP::Lite;
>
> print "The SOAP Server says: ";
> print SOAP::Lite
> -> uri('urn:xmltoday-delayed-quotes')
> -> proxy('http://localhost:8080/axis/servlet/AxisServlet')
> -> getQuote('user1', 'XXX')
> -> result . "\n\n";
>
>
>
> --
> John G. Heim
> University of Wisconsin - Division of Information Technology (DoIT)
> 1210 West Dayton St, #4297, Phone: 2-9887
>
> To boldly code what no one has coded before.
>
>