You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Steve Baker <st...@aol.com> on 2005/08/18 18:40:21 UTC

Can't get SOAP to work under mod_perl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.2.33/mod_perl 1.29, and a Soalris 8 box with Apache 1.1.28 and
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(0x18baed8)
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/"><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.
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 the Mac, 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 error (10)

I THINK the child process is being killed on the Solaris box too, but
I'm not sure of that. There's nothing in the log about it, but that's a
production box and I'm not free to mess with it too much in my testing.

As I mentioned, I've tried other methods (SOAP::Transport::HTTP::Apache
and Apache::Registry) and I get exactly the same result. I've follwed
examples from "mod_perl Developer's Cookbook", and "Programming Web
Services with Perl" as well as from perl.apache.org and
guilde.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
- --
Steve Baker
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBLn1z179gX3oLkwRAlUAAJ0ZIYhjR3dz2Ig9bybU2o/1qgRNuwCdGqzu
TXhPGhCA8H/rQn63ijW9FVI=
=KGiM
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

randy@theoryx5.uwinnipeg.ca wrote:
| On Thu, 18 Aug 2005, Steve Baker wrote:
|
|> -----BEGIN PGP SIGNED MESSAGE-----
|> Hash: SHA1
|>
|> 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.2.33/mod_perl 1.29, and a Soalris 8 box with Apache 1.1.28 and
|> 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.
|
| [ ... ]
| If you change the directive specifying dispatch_to to
|    PerlSetVar dispatch_to "/dir/containing/Demo, Demo"
| does that work?
|

Nope, I get exactly the same error.
Thanks
- --
Steve Baker
AOL Configuration Management
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBMVfz179gX3oLkwRArSCAJ9TIPHTZ03mqoaaOgaLLwij4EWe4gCeOFgj
6eR2UMxck4s7zwvIpo5m80Q=
=cAWZ
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 18 Aug 2005, Steve Baker wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.2.33/mod_perl 1.29, and a Soalris 8 box with Apache 1.1.28 and
> 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.
[ ... ]
If you change the directive specifying dispatch_to to
    PerlSetVar dispatch_to "/dir/containing/Demo, Demo"
does that work?

-- 
best regards,
randy kobes

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

perrin@elem.com wrote:
| On Thu, 2005-08-18 at 09:40 -0700, Steve Baker wrote:
|
|>I have two systems I'm trying to do this on: A Mac with Apache
|>1.2.33/mod_perl 1.29, and a Soalris 8 box with Apache 1.1.28 and
|>mod_perl 1.27.
|
|
| One thing that might help is to use the most recent apache and mod_perl
| versions (in the 1.x series) on both.  It just doesn't help to use
| versions with known bugs and security problems.  Those versions of
| apache are positively antique.

I apologize -- that was a massive typo on my part. The versions of
apache I am using are 1.3.33 (mac) and 1.3.28 (solaris). So believe I
have the latest 1.x Apache/mod_perl on one box, and a set not too much
older on the other.
Thanks
- --
Steve Baker
AOL Configuration Management
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBL/tz179gX3oLkwRAt8hAJ0bWsI35Ou2zZ8OZpb+1WNR42LBXgCdHpdC
xkmdLHDmYRzZfW+1iNe9UOs=
=gih8
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2005-08-18 at 09:40 -0700, Steve Baker wrote:
> I have two systems I'm trying to do this on: A Mac with Apache
> 1.2.33/mod_perl 1.29, and a Soalris 8 box with Apache 1.1.28 and
> mod_perl 1.27.

One thing that might help is to use the most recent apache and mod_perl
versions (in the 1.x series) on both.  It just doesn't help to use
versions with known bugs and security problems.  Those versions of
apache are positively antique.

- Perrin


Re: Can't get SOAP to work under mod_perl

Posted by Larry Leszczynski <la...@emailplus.org>.
On Mon, 22 Aug 2005, Perrin Harkins wrote:

> On Mon, 2005-08-22 at 09:37 -0700, Steve Baker wrote:
>> While I'm familiar with Perl, I am less familiar with SOAP and
>> mod_perl.
>
> Is there a SOAP-Lite support list?  Your problem does not seem to be
> with mod_perl, but rather with SOAP-Lite.  If there's no specific list,
> you might try asking on perlmonks.org or comp.lang.perl.misc.

http://groups.yahoo.com/group/soaplite/


Larry

Re: Can't get SOAP to work under mod_perl

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2005-08-22 at 09:37 -0700, Steve Baker wrote:
> I've continued to work on this, but have been unable to progress past
> this point. mod_perl seems to work just fine on both systems, except
> when it comes to SOAP, in which case I'm getting exactly the same errors
> on both systems. I must be doing SOMETHING wrong, but danged if I can
> spot it. While I'm familiar with Perl, I am less familiar with SOAP and
> mod_perl.

Is there a SOAP-Lite support list?  Your problem does not seem to be
with mod_perl, but rather with SOAP-Lite.  If there's no specific list,
you might try asking on perlmonks.org or comp.lang.perl.misc.

- Perrin


Re: Can't get SOAP to work under mod_perl

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Tue, 23 Aug 2005, Steve Baker wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> randy@theoryx5.uwinnipeg.ca wrote:
> | As Perrin mentioned, this may not be a problem with mod_perl
> | specifically, so it may be worth asking on the soap-lite
> | mailing list. Just to verify this, I've placed at
> |   http://people.apache.org/~randyk/
> | a file, bug-reporting-skeleton-mp1.tar.gz, which can be
> | used to test your mod_perl SOAP installation. To use it:
> |   perl Makefile.PL
> |   make
> |   make test
> | If the tests pass, can you see differences between the
> | modules and/or configuration used here and the one you
> | have? If the tests don't pass, is there anything useful
> | in the error log? Or does
> |   perl t/TEST -v
> | provide any clues?
> |
>
> It doesn't appear I can run this. It uses ModPerl::MM, 
> which appears to be part of mod_perl 2, but as I 
> mentioned, I'm using 1.29.

Sorry about that - I forgot to change that section in
the Makefile.PL. I replaced the archive in the link above
with one that has the appropriate change.

-- 
best regards,
randy

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

randy@theoryx5.uwinnipeg.ca wrote:
| As Perrin mentioned, this may not be a problem with mod_perl
| specifically, so it may be worth asking on the soap-lite
| mailing list. Just to verify this, I've placed at
|   http://people.apache.org/~randyk/
| a file, bug-reporting-skeleton-mp1.tar.gz, which can be
| used to test your mod_perl SOAP installation. To use it:
|   perl Makefile.PL
|   make
|   make test
| If the tests pass, can you see differences between the
| modules and/or configuration used here and the one you
| have? If the tests don't pass, is there anything useful
| in the error log? Or does
|   perl t/TEST -v
| provide any clues?
|

It doesn't appear I can run this. It uses ModPerl::MM, which  appears to
be part of mod_perl 2, but as I mentioned, I'm using 1.29.

I thought I'd start with the modperl list, since this all works under
CGI, and I assumed the problem would be something I have misconfigured
in mod_perl or something I have to do differently with mod_perl. I'll go
pester the SOAP people now. :-)

Thanks for the help everyone!
- --
Steve Baker
AOL Configuration Management
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDCyGiz179gX3oLkwRAjnFAJ9inRKDWODvRNKyjEdrCWVTL8h+RgCfeTMl
fv+tH8uELViePDPqhxsD2Yo=
=T/Yn
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 22 Aug 2005, Steve Baker wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I've continued to work on this, but have been unable to progress past
> this point. mod_perl seems to work just fine on both systems, except
> when it comes to SOAP, in which case I'm getting exactly the same errors
> on both systems. I must be doing SOMETHING wrong, but danged if I can
> spot it. While I'm familiar with Perl, I am less familiar with SOAP and
> mod_perl. I've doublechecked the httpd.conf entries and I believe they
> are correct. The Demo.pm file is too simple to have an error (famous
> last words), so now I've concerntrating on the client code, which is the
> part I understand the least.

As Perrin mentioned, this may not be a problem with mod_perl
specifically, so it may be worth asking on the soap-lite
mailing list. Just to verify this, I've placed at
   http://people.apache.org/~randyk/
a file, bug-reporting-skeleton-mp1.tar.gz, which can be
used to test your mod_perl SOAP installation. To use it:
   perl Makefile.PL
   make
   make test
If the tests pass, can you see differences between the
modules and/or configuration used here and the one you
have? If the tests don't pass, is there anything useful
in the error log? Or does
   perl t/TEST -v
provide any clues?

-- 
best regards,
randy

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've continued to work on this, but have been unable to progress past
this point. mod_perl seems to work just fine on both systems, except
when it comes to SOAP, in which case I'm getting exactly the same errors
on both systems. I must be doing SOMETHING wrong, but danged if I can
spot it. While I'm familiar with Perl, I am less familiar with SOAP and
mod_perl. I've doublechecked the httpd.conf entries and I believe they
are correct. The Demo.pm file is too simple to have an error (famous
last words), so now I've concerntrating on the client code, which is the
part I understand the least.

In particular, I'm confused about the value passed to uri(). I'm using
"http://<my server>/Demo", where Demo is the name of the module I want
to call, and Demo.pm is in the PATH. That, and "http://localhost/Demo"
both work in my CGI-based SOAP experiments, but neither works with
mod_perl. Is this an area where mod_perl and CGI differ?

Thanks for any clues anyone can provide.

Steve

Steve Baker wrote:
| 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 Soalris 8 box with Apache 1.3.28 and
| 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(0x18baed8)
| 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/"><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.
| 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 the Mac, 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 error
| (10)
|
| I THINK the child process is being killed on the Solaris box too, but
| I'm not sure of that. There's nothing in the log about it, but that's a
| production box and I'm not free to mess with it too much in my testing.
|
| As I mentioned, I've tried other methods (SOAP::Transport::HTTP::Apache
| and Apache::Registry) and I get exactly the same result. I've follwed
| examples from "mod_perl Developer's Cookbook", and "Programming Web
| Services with Perl" as well as from perl.apache.org and
| guilde.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
| --
| Steve Baker
| kiku wa ittoki no haji
| kikanu wa matsudai no haji

- --
Steve Baker
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDCf9Xz179gX3oLkwRAi+EAKCcqbZUvkFVLXbH5+rXG0heSafkWACggFVx
3D2nlvWo66oJuurDSY39tXE=
=Wwth
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

randy@theoryx5.uwinnipeg.ca wrote:
| On Thu, 18 Aug 2005, Steve Baker wrote:
|
| [ ... ]
|
|> This is my client now:
|>
|> use SOAP::Lite +trace => [qw(all)];
|>
|> my $soap = SOAP::Lite->uri('http://<my server>/Demo')
|> ~    ->proxy('http://<my server>/steve/rpc/')->on_fault(
|> ~    sub {
|> ~        my ($soap, $res) = @_;
|> ~        die ref $res ? $res->faultdetail : $soap->transport->status,
|> "\n";
|> ~    }
|> ~    );
|> my $obj = $soap->call('hi');
|> print $obj->result;
|>
|> ~From the output, it looks like the call is being made, and it is
|> succeeding:
|
| [ ... ]
|
|> On the other hand, I get similar results with known bad input (calling a
|> method which doesn't exist, putting a non-existent module name in the
|> uri, etc) so I'm pretty sure the module is never really loaded.
|
|
| Does adding a
|    PerlModule Demo
| to httpd.conf, before the soap location, do anthing different?
|

No, no change at all. :-(
Thanks
- --
Steve Baker
AOL Configuration Management
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBfraz179gX3oLkwRAvd7AJ4v03quwV8dNe9Gv0Yd2AAE/2ZrywCeNmeF
EQdPdbD/jDG1MUcRzaOrAmw=
=+Uyf
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 18 Aug 2005, Steve Baker wrote:

[ ... ]
> This is my client now:
>
> use SOAP::Lite +trace => [qw(all)];
>
> my $soap = SOAP::Lite->uri('http://<my server>/Demo')
> ~    ->proxy('http://<my server>/steve/rpc/')->on_fault(
> ~    sub {
> ~        my ($soap, $res) = @_;
> ~        die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
> ~    }
> ~    );
> my $obj = $soap->call('hi');
> print $obj->result;
>
> ~From the output, it looks like the call is being made, and it is
> succeeding:
[ ... ]
> On the other hand, I get similar results with known bad input (calling a
> method which doesn't exist, putting a non-existent module name in the
> uri, etc) so I'm pretty sure the module is never really loaded.

Does adding a
    PerlModule Demo
to httpd.conf, before the soap location, do anthing 
different?

-- 
best regards,
randy

Re: Can't get SOAP to work under mod_perl

Posted by Steve Baker <st...@aol.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

geoff@modperlcookbook.org wrote:
|>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;
|
|
| try
|
|   my $soap = SOAP::Lite
|     ->uri('http://<my server>/Demo')
|     ->proxy('http://<my server>/steve/rpc/')
|     ->on_fault(sub { my ($soap, $res) = @_;
|                       die ref $res ?
|                         $res->faultdetail :
|                         $soap->transport->status, "\n"
|        });
|
| that should help you with tracing errors.  also, it's been a while since
| I've played around with SOAP::Lite, but IIRC unless you used +autodispatch
| your call ought to look like
|
|   my $obj = $soap->call('hi');
|   print $obj->result;

Neither change had any effect. The output is exactly the same; no
additional output from the fault handler. This is my client now:

use SOAP::Lite +trace => [qw(all)];

my $soap = SOAP::Lite->uri('http://<my server>/Demo')
~    ->proxy('http://<my server>/steve/rpc/')->on_fault(
~    sub {
~        my ($soap, $res) = @_;
~        die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
~    }
~    );
my $obj = $soap->call('hi');
print $obj->result;

~From the output, it looks like the call is being made, and it is
succeeding:

SOAP::Transport::HTTP::Client::send_receive: POST
http://www.cm.aol.com/steve/rpc/ HTTP/1.1
Accept: text/xml
Accept: multipart/*
Content-Length: 449
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.cm.aol.com/Demo6#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/Demo6"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x19076e8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/0.9 200 (OK) EOF
Client-Date: Thu, 18 Aug 2005 17:39:21 GMT
Client-Peer: 10.178.2.10:80
Client-Response-Num: 1

On the other hand, I get similar results with known bad input (calling a
method which doesn't exist, putting a non-existent module name in the
uri, etc) so I'm pretty sure the module is never really loaded.

Thanks
- --
Steve Baker
AOL Configuration Management
kiku wa ittoki no haji
kikanu wa matsudai no haji
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDBMw0z179gX3oLkwRAjuzAKCd/K90YHax+55W4m3Kd3gkitraHgCfabAc
trN0eXt2JuZn8PXnpeaGycI=
=ceYT
-----END PGP SIGNATURE-----

Re: Can't get SOAP to work under mod_perl

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> 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;

try

  my $soap = SOAP::Lite
    ->uri('http://<my server>/Demo')
    ->proxy('http://<my server>/steve/rpc/')
    ->on_fault(sub { my ($soap, $res) = @_;
                      die ref $res ?
                        $res->faultdetail :
                        $soap->transport->status, "\n"
       });

that should help you with tracing errors.  also, it's been a while since
I've played around with SOAP::Lite, but IIRC unless you used +autodispatch
your call ought to look like

  my $obj = $soap->call('hi');
  print $obj->result;

HTH

--Geoff

Re: Can't get SOAP to work under mod_perl

Posted by Kurt Hansen <kh...@charityweb.net>.
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