Ask a Question related to PERL Miscellaneous, Design and Development.
-
Yarden Katz #1
Re: using SOAP::Lite to call other services.
Eric Amick <eric-amick@comcast.net> writes:
I've tried this before (I noticed the same thing with the examples)> On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
> wrote:
>>>>Hi,
>>
>> I'm using SOAP::Lite to write a few services. I managed to get a
>> few clients/server running correctly.
>>
>> I'm having trouble getting SOAP::Lite to call external, non-Perl
>> services, however. The service I am interested in is
>> 'ValidateEmail' (see
>> [url]http://www.webservicex.net/ValidateEmail.asmx[/url]).
>>
>> According to the SOAP::Lite documentation, it is perfectly valid to
>> do:
>>
>> print "RESULT: ", SOAP::Lite
>> -> uri('http://www.webserviceX.NET')
>> -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
>> -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
>> -> IsValidEMail($email) . "\n";
> None of their examples use both proxy() and service(). Try eliminating
> the proxy().
but have only one or only the other do not change the results. Any
other ideas?
Appreciate your help,
--
Yarden Katz <katz@underlevel.net> | Mind the gap
Yarden Katz Guest
-
Writing a HTML/ASP SOAP client for a SOAP::Lite destination
How would I go about writing a SOAP client in either HTML or classic asp? The SOAP "listener" was written in Perl with SOAP::Lite in Unix and I am... -
SOAP::Lite : Problem of # sign added by SOAP::Lite in the sent SOAPActionstring
Hello, I have a problem with a SOAP client written in Perl (source at the end). I've tried both ways (by commenting TRIAL ONE or SECOND TRIAL),... -
SOAP::Lite : BUG somewhere
I tried running the demo scripts given in the SOAP::Lite tutorial that appeared in http://www.perl.com/pub/a/2001/01/soap.html. According to this... -
SOAP::Lite HELP!
I've written soap clients before but never anything this complicated. Here are the links PIRP: http://homer.meso.com/crap/PIRP_Schema_v1.xsd... -
soap::lite and dbd::csv
sorry !! my english is very poor. i got some trouble ! please help ! if $vars is constant in Bridge.pm then the process is right! ps:DBD::CVS ... -
Yarden Katz #2
Re: using SOAP::Lite to call other services.
Eric Amick <eric-amick@comcast.net> writes:
I tried calling a different service with SOAP::Lite and I'm getting> On Mon, 23 Jun 2003 16:50:36 -0500, Yarden Katz <katz@underlevel.net>
> wrote:
>>>>Hi,
>>
>> I'm using SOAP::Lite to write a few services. I managed to get a
>> few clients/server running correctly.
>>
>> I'm having trouble getting SOAP::Lite to call external, non-Perl
>> services, however. The service I am interested in is
>> 'ValidateEmail' (see
>> [url]http://www.webservicex.net/ValidateEmail.asmx[/url]).
>>
>> According to the SOAP::Lite documentation, it is perfectly valid to
>> do:
>>
>> print "RESULT: ", SOAP::Lite
>> -> uri('http://www.webserviceX.NET')
>> -> proxy('http://www.webservicex.net/ValidateEmail.asmx')
>> -> service('http://www.webservicex.net/ValidateEmail.asmx?WSDL')
>> -> IsValidEMail($email) . "\n";
> None of their examples use both proxy() and service(). Try eliminating
> the proxy().
similarly weird results:
use SOAP::Lite +autodispatch, +trace => debug;
my $soap = SOAP::Lite
-> uri('http://www.worldwidedesktop.com/spellcheck')
-> on_action(sub {sprintf '%s/%s', @_})
-> proxy('http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx');
$soap = $soap->SpellCheck( SOAP::Data->name(TextToCheck => 'foo') );
The SOAP message I get back is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. --> Object reference not set to an instance of an object.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
This makes no sense, because the message that my snippet above
actually sent (as printed by +debug) was:
SOAP::Transport::HTTP::Client::send_receive: POST [url]http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx[/url]
Accept: text/xml
Accept: multipart/*
Content-Length: 544
Content-Type: text/xml; charset=utf-8
SOAPAction: [url]http://www.worldwidedesktop.com/spellcheck/SpellCheck[/url]
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<namesp1:SpellCheck
xmlns:namesp1="http://www.worldwidedesktop.com/spellcheck">
<TextToCheck xsi:type="xsd:string">foo</TextToCheck>
</namesp1:SpellCheck>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The message that this service expects, as written by its documentation
(at
[url]http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx?op=SpellCheck[/url])
is:
POST /spellcheck/spellcheckservice.asmx HTTP/1.1
Host: [url]www.worldwidedesktop.com[/url]
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.worldwidedesktop.com/spellcheck/SpellCheck"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SpellCheck xmlns="http://www.worldwidedesktop.com/spellcheck">
<LicenseText>string</LicenseText>
<TextToCheck>string</TextToCheck>
</SpellCheck>
</soap:Body>
</soap:Envelope>
As far as I can tell, the message the server documentation shows and
the one sent by my client are almost identical. I see no reason why
this call would fail.. the service itself is functioning, so the
problem must be on my end.
Thanks a lot,
--
Yarden Katz <katz@underlevel.net> | Mind the gap
Yarden Katz Guest
-
Bryan Castillo #3
Re: using SOAP::Lite to call other services.
Yarden Katz <katz@underlevel.net> wrote in message news:<86ptl3obqz.fsf@underlevel.net>...
I was able to get one response back by setting:> James McIninch <james.mcininch@attbi.com> writes:
>>> > A few things: I'd suggest that you use the +trace option to SOAP::Lite to
> > see what's going on under the covers -- It's very informative. Next, you
> > are calling a Microsoft .Net service (.asmx), meaning that it's probably
> > not strictly SOAP compliant. The SOAP::Lite documentation give pointers on
> > how to compensate for the pecualiarities of the bugs in .Net. Finally, if
> > you specify the service() to SOAP::Lite, you should leave off the proxy()
> > and the uri() since the service() is supposed to set those things for you.
> A couple of things: I've been using +trace from the start (that's how
> I knew what message my client was sending) and it is indeed very
> useful. I've tried the combination you suggested (removing
> uri()/proxy() and just using service()) but I get the same results.
>
> Additionally, for another .asmx service I was attempting to call,
> removing proxy() and just pointing service to the WSDL file was not an
> option. When I did that, I'd get the error: Transport not specified
> (use proxy() or service method)
the on_action callback and specifying the namespace
for the method.
(I needed the on_action so that the SOAPAction header had uri/method instead
of uri#method.)
If you look at the trace there are many results, but the result
I get from perl only has 1 item.
(You know I was able to hook perl almost seemlessly into some java
web services using Apache Axis - I don't know why this is so
difficult. Is it perl or .NET, or do I just not get this?
I thought the beauty of remote method like frameworks was that
you didn't have to really know the protocol, and that libraries would
do the work for you).
use strict;
use warnings;
use Data::Dumper;
use SOAP::Lite +trace => 'all';
#use SOAP::Lite;
my $service = SOAP::Lite
->proxy('http://www.worldwidedesktop.com/spellcheck/spellcheckservice.asmx')
->uri('http://www.worldwidedesktop.com/spellcheck/SpellCheck')
->on_action(sub{ sprintf "%s/%s", @_ });
my $xmlns = 'http://www.worldwidedesktop.com/spellcheck';
my $method = SOAP::Data
->name('SpellCheck')
->attr({xmlns=>$xmlns});
my $response = $service->call($method => _sd(
LicenseText => '',
TextToCheck => 'blonk'
));
die "Error: getting response\n" unless defined($response);
print "Response = ", Dumper($response->result), "\n";
# convert key/values to SOAP::Data
sub _sd {
my @p;
for (my $i=0; $i<$#_; $i+=2) {
push(@p, SOAP::Data->name($_[$i]=>$_[$i+1]));
}
return @p;
}
Bryan Castillo Guest



Reply With Quote

