SOAP::Lite "service" examples

X

xhoster

I'm having trouble getting SOAP::Lite "service" method to work properly.
All of the examples I've seen point to wsdl's that are either not found
or just give no response.

http://www.xmethods.net/sd/StockQuoteService.wsdl
http://svc.perl.org/Svc.wsdl

Does anyone have a working example of how to make a call with SOAP::Lite
service which uses a working, publicly available SOAP server?

Also, I haven't been impressed with my experience with SOAP::Lite. When I
try to use it on our internal wsdls I get inscrutable errors, where other
language's SOAP support seems to work fine. Is there something else
designed to make SOAP easy to use that I might want to try? (SOAP::WSDL
uses SOAP::Lite under the hood, so I suspect it will have the same problem.
It refuses to install with cpan under a non-privileged user, so I haven't
yet tested it directly. Trying to fix that will be the next step, unless I
get good suggestions here.)

Thanks,

Xho
 
I

Ian Wilson

I'm having trouble getting SOAP::Lite "service" method to work properly.
All of the examples I've seen point to wsdl's that are either not found
or just give no response.

http://www.xmethods.net/sd/StockQuoteService.wsdl
http://svc.perl.org/Svc.wsdl

Does anyone have a working example of how to make a call with SOAP::Lite
service which uses a working, publicly available SOAP server?

Public services seem to be somewhat ephemeral.

It isn't hard to make a trivial SOAP::Lite service of your own, use
POD::WSDL to create some WSDL for it and then consume that WSDL with a
SOAP::Lite client that uses the "service" method.
Also, I haven't been impressed with my experience with SOAP::Lite. When I
try to use it on our internal wsdls I get inscrutable errors, where other
language's SOAP support seems to work fine. Is there something else
designed to make SOAP easy to use that I might want to try? (SOAP::WSDL
uses SOAP::Lite under the hood, so I suspect it will have the same problem.

SOAP::Lite is somewhat quirky and has poor support for any SOAP service
that isn't RPC/Encoded.

I haven't found anything better than SOAP::Lite. Actually, there doesn't
seem to be any significant competition.
 
X

xhoster

John said:
Hi

I have been down this road before.

Can you show us what you have already written?

I'm just using the client side, and unfortunately I don't think that
showing you that will do much good without also providing the whole
server side stuff, wsdl (which I have access to but would need to
go through obstructionist lawyers to show you) plus the implementation
(which I don't even have access to, or know what language it is in). Alas,
that is why I was hoping for an example using a publicly accessible
server--that way the client stuff would be meaningful to you, as we would
be using the same server.

Anyway, what I do is:

#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite service =>
'http://bioinf-dev07/services/foobaloo.asmx?wsdl';
print HelloWorldSimple();
__END__

Can't call method "name" without a package or object reference at
/tools/GNU/perl/5.8.7_64/lib/site_perl/5.8.7/SOAP/Lite.pm line 3005.
BEGIN failed--compilation aborted at soap.pl line 5.



I have SOAP::Lite version:

# $Id: Lite.pm,v 1.43 2006/08/16 14:49:34 byrnereese Exp $

Isolating around the problem, starting at line 3003:

foreach (@{$services->{$service}{parameters}}) {
# next unless $_;
$self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."',
type => '".$_->type."', attr => {";

So the commenting out of "next unless $_" allows truly empty $_ to reach
the following line, triggering the error. However, if I comment it back
in, then everything gets skipped, apparently because $_ is an object which
seems to have overloaded operations which cause it to evaluate as false in
this (stringification?) context. I changed the line to execute the "next"
on only the values of $_ which are true empty strings, rather than objects
with overloaded operations:

next if not ref $_ and not $_;

And that solves that particular error, but now nothing is printed in the
final line of my script. (In python and C# against the same WSDL/server,
HelloWorldSimple() does return a meaningful string)

Anyway, I will work on making a simplified WSDL and a Server to serve it,
that I can post both of.

Thanks,

Xho
 
A

anno4000

[...]
Isolating around the problem, starting at line 3003:

foreach (@{$services->{$service}{parameters}}) {
# next unless $_;
$self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."',
type => '".$_->type."', attr => {";

So the commenting out of "next unless $_" allows truly empty $_ to reach
the following line, triggering the error. However, if I comment it back
in, then everything gets skipped, apparently because $_ is an object which
seems to have overloaded operations which cause it to evaluate as false in
this (stringification?) context.

Boolean. Overload generates a boolean value out of quite a few others,
most notably stringification. That often comes unexpected to the
programmer, as seems to be the case here.
I changed the line to execute the "next"
on only the values of $_ which are true empty strings, rather than objects
with overloaded operations:

next if not ref $_ and not $_;

If you can modify the "use overload" statement (I'm not quite clear
about what is where), adding

bool => sub { 1 },

would be an alternative. I'm not saying it's going to make a difference
but who knows. If there is a similar problem elsewhere it would be
fixed too.

Anno
 

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

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top