perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurt Hansen <khan...@charityweb.net>
Subject Re: Can't get SOAP to work under mod_perl
Date Thu, 18 Aug 2005 17:34:07 GMT
Steve Baker wrote:

> http://www.cm.aol.com/steve/rpc/ HTTP/1.1
> Accept: text/xml
> Accept: multipart/*
> Content-Length: 448
> Content-Type: text/xml; charset=utf-8
> SOAPAction: "http://www.cm.aol.com/Demo#hi"
> 
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:hi

> 
> xmlns:namesp1="http://www.cm.aol.com/Demo"/></SOAP-ENV:Body></SOAP-ENV:Envelope>

> 
> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x18c18e4)
> SOAP::Transport::HTTP::Client::send_receive: HTTP/0.9 200 (OK) EOF
> Client-Date: Thu, 18 Aug 2005 16:22:41 GMT
> Client-Peer: 10.178.2.10:80
> Client-Response-Num: 1
> 
> Can't call method "result" on an undefined value at ./test1.pl line 13.

Hi,

Are you by chance communicating with a Windows server? I had problems 
communicating using SOAP with a Windows server, though I was able to 
communicate with other public services (see below for example code for 
ones I could get to work). I was given the following article which 
enabled me to finally get it to work:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsoap/html/soapliteperl.asp

The issue was with two things. One, I had to do something to "on_action" 
as noted below. The article has a different solution. Two, the Windows 
server did not like the XML that SOAP::Lite produced. Specifically, it 
was the data that the Windows server could not read. SOAP::Lite produced 
  XML that added a namespX: at the front of the data tag, e.g.

<namesp2:SOMENAME DATANAME xsi:type="xsd:string">data</DATANAME>

while the Windows server expected:

<DATANAME xsi:type="xsd:string">data</DATANAME>

Strangely enough, I can't re-create what was going wrong right now so 
what you see above is partially from memory.

I implemented the suggestions in the above article and it started working.

Example of other services that I got to work, no problem:

use SOAP::Lite +trace =>
        [qw(transport debug)],
        on_action => sub {sprintf '%s/%s', @_};

my $response;
my $s = SOAP::Lite
     -> uri('/examples')
     -> on_action(sub { sprintf '"%s"', shift })
     -> proxy('http://superhonker.userland.com/')
   ;

print '\n\n State '.$s->getStateName(SOAP::Data->name(statenum => 
25))->result ;

$s = SOAP::Lite
     -> uri('urn:xmethods-CurrencyExchange')
     -> proxy('http://services.xmethods.net/soap');

$response = $s->getRate(SOAP::Data->name(country1 => 'England'),
                      SOAP::Data->name(country2 => 'Japan'))
             ->result;
print 'Currency rate for England/Japan is ', $response;


Take care,

Kurt
khansen@charityweb.net

Mime
View raw message