Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Getting SOAP to work with mod_perl

by tektsu (Acolyte)
on Aug 22, 2005 at 17:00 UTC ( #485730=perlquestion: print w/ replies, xml ) Need Help??
tektsu has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to get SOAP to work under mod_perl. Googling about and reading what I can find on it, it looks like there are many ways to do this, but they are all giving me the same (non-working) result.

I have two systems I'm trying to do this on: A Mac with Apache 1.3.33/mod_perl 1.29, and a Solaris 8 box with Apache 1.3.28/mod_perl 1.27.

My most recent attempts have been with Apache::SOAP, so I'll use that as my example:

I have this in my httpd.conf:
<Location /steve/rpc/> SetHandler perl-script PerlHandler Apache::SOAP PerlSetVar dispatch_to 'Demo' </Location>
Demo.pm is in the @INC path. It contains:
package Demo; sub hi { return "hello, world"; }
I call it like this:
use SOAP::Lite +trace => [qw(all)]; my $soap = SOAP::Lite->uri('http://<my server>/Demo'); my $proxy = $soap->proxy('http://<my server>/steve/rpc/'); my $obj = $proxy->hi(); print $obj->result;
The (rather verbose) output is:
SOAP::Transport::new: () SOAP::Serializer::new: () SOAP::Deserializer::new: () SOAP::Parser::new: () SOAP::Lite::new: () SOAP::Transport::HTTP::Client::new: () SOAP::Lite::call: () SOAP::Serializer::envelope: () SOAP::Serializer::envelope: hi SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Data::new: () SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x18ba +ed8) SOAP::Transport::HTTP::Client::send_receive: POST 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/"><SO +AP-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(0x18c +18e4) 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 +. SOAP::Lite::DESTROY: () SOAP::Serializer::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Data::DESTROY: () SOAP::Deserializer::DESTROY: () SOAP::Parser::DESTROY: () SOAP::Transport::DESTROY: () SOAP::Transport::HTTP::Client::DESTROY: ()
The problem is the $obj is always undefined. This happens whether or not the method I call actually exists, which leads me to believe the Demo.pm file isn't even being loaded, but I'm not sure of that. It seems like it SHOULD be loaded...

On both system, calling the method "$proxy->hi();" kills the Apache child process with an error like this in the error_log:
[Thu Aug 18 09:21:40 2005] [notice] child pid 868 exit signal Bus erro +r (10)
As I mentioned, I've tried other methods (SOAP::Transport::HTTP::Apache and Apache::Registry) and I get exactly the same result. I've followed examples from "mod_perl Developer's Cookbook", and "Programming Web Services with Perl" as well as from perl.apache.org and guide.soaplite.com. It's only the mod_perl examples I can't get to work. I'm using these scripts (Demo.pm and others) fine with CGI SOAP. I'm thinking something is misconfigured in mod_perl, but darned if I can figure out what.

Can anyone point out what I'm missing? Or at least point out a different FM to R?

Thanks


tektsu
kiku wa ittoki no haji kikanu wa matsudai no haji

Janitored by Arunbear - replaced pre tags with code tags.

Comment on Getting SOAP to work with mod_perl
Select or Download Code
Re: Getting SOAP to work with mod_perl
by jeteve (Pilgrim) on Aug 22, 2005 at 17:35 UTC
    Hi. Did you try implementing you Demo as a class that can make instance. With a new method (no param except class) and methods implemented as instance methods (first param instance).

    I don't know if it solves your problem, but when the server side service is handled by SOAP::Lite as CGI, this implementation work.

    Hope it helps.

    -- Nice photos of naked perl sources here !

      Sadly, that made no difference.
      Thanks


      tektsu
      kiku wa ittoki no haji kikanu wa matsudai no haji
Re: Getting SOAP to work with mod_perl
by fokat (Deacon) on Aug 23, 2005 at 16:32 UTC

    Dear tektsu

    In my quest for deciding which I like best between Catalyst and Maypole, I've found various references to Mac OS X's apache and mod_perl working unreliable or not working at all with some modules. In those references, the authors always recommended building your own apache / mod_perl. In that case I would also build my own perl...

    I hope this helps.

    Best regards

    -lem, but some call me fokat

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://485730]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-10-31 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (215 votes), past polls