You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rizwan Majeed <ri...@afapp.net> on 2002/02/27 09:33:04 UTC

trouble with mod-perl soap handler

Hi all,

I really need some help.

I am using the mod-perl handler for soap. 
I wasnt sure how to test it. Can any body tell me how to test the service I make.

MORE Importantly.
how should I make sure the handler is invoked. I think it is not being invoked. I have also copied the package in the perls @INC path "/..../site_perl". The package has a handler function that should be invoked.


Thanks

Riz

Re: trouble with mod-perl soap handler

Posted by Rizwan Majeed <ri...@afapp.net>.
Thanks for the help

I am doing the following:

#----------
package ServerDemo;

use strict;


use SOAP::Transport::HTTP::Apache;


sub handler {

   my $safe_classes = {

   BlotterService => undef


   };


   SOAP::Transport::HTTP::Apache->handler($safe_classes);

}

#-------

package BlotterService;

use strict;




sub new {

 bless {}, shift;

}


sub handle_request {

 my ($self, $headers, $body, $envelopeMaker) = @_;

    $body->{extra_stuff} = "heres some extra stuff";

    foreach my $header (@$headers)
    {
        $header->{extra_stuff} = "heres some more extra stuff";
        $envelopeMaker->add_header(undef, undef, 0, 0, $header);
    }

    $envelopeMaker->set_body(undef, 'myresponse', 0, $body);

}




I am still unable to check it/ write a client for it. I always get the error
"Bad Request". I have also addedd the location tag in httpd.conf


Thanks.

Rizwan






----- Original Message -----
From: "Mark Fowler" <ma...@twoshortplanks.com>
To: "Rizwan Majeed" <ri...@afapp.net>
Cc: <mo...@apache.org>
Sent: Wednesday, February 27, 2002 2:58 PM
Subject: Re: trouble with mod-perl soap handler


> On Wed, 27 Feb 2002, Rizwan Majeed wrote:
>
> > I am using the mod-perl handler for soap.  I wasnt sure how to test it.
> > Can any body tell me how to test the service I make.
>
> Hi.
>
> I was playing with this stuff yesterday, so here are some points from
> someone who's new to this stuff
>
> First off, there's an example in the mod_perl cookbook.  See chapter 15,
> secion 15.16 "Creating a SOAP server".  In particular, the listing you
> might want to take a look at is the example of a script that calls thier
> soap server server.
>
>
http://www.modperlcookbook.org/code/ch15/HalfLife-QueryServer-0.10/eg/querys
oap.pl
>
> Secondly, have a look at Leon Brocard's stuff at
> http://www.astray.com/services/  This is a further example of using SOAP -
> this time to call a infobot.
>
> Basically what you want to do from your client is
>
> #!/usr/bin/perl
>
> use SOAP::Lite +autodispatch =>
>   uri   => 'Some unique uri to identify your request',
>   proxy => 'The url that is in your Location in httpd.conf';
>
> my $object = NameOfMySOAPedModule->new();
> $object->a_method();
> $object->an_other_method();
>
> > MORE Importantly. how should I make sure the handler is invoked. I think
> > it is not being invoked. I have also copied the package in the perls
> > @INC path "/..../site_perl". The package has a handler function that
> > should be invoked.
>
> Try GETing the url.  Assuming you have LWP installed:
>
> [mark@pate mark]$ GET http://2shortplanks.com/mod_soap
> <HTML>
> <HEAD><TITLE>An Error Occurred</TITLE></HEAD>
> <BODY>
> <H1>An Error Occurred</h1>
> 405 Method Not Allowed
> </BODY>
> </HTML>
>
> For a simple GET if the handler is being called you should get the 405
> (as you didn't issue a proper soap request.)
>
> --
> s''  Mark Fowler                                     London.pm   Bath.pm
>      http://www.twoshortplanks.com/              mark@twoshortplanks.com
> ';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
> ){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}


Re: trouble with mod-perl soap handler

Posted by Mark Fowler <ma...@twoshortplanks.com>.
On Wed, 27 Feb 2002, Rizwan Majeed wrote:

> I am using the mod-perl handler for soap.  I wasnt sure how to test it.
> Can any body tell me how to test the service I make.

Hi.

I was playing with this stuff yesterday, so here are some points from 
someone who's new to this stuff

First off, there's an example in the mod_perl cookbook.  See chapter 15,
secion 15.16 "Creating a SOAP server".  In particular, the listing you
might want to take a look at is the example of a script that calls thier
soap server server.

http://www.modperlcookbook.org/code/ch15/HalfLife-QueryServer-0.10/eg/querysoap.pl

Secondly, have a look at Leon Brocard's stuff at  
http://www.astray.com/services/  This is a further example of using SOAP - 
this time to call a infobot.

Basically what you want to do from your client is

#!/usr/bin/perl

use SOAP::Lite +autodispatch =>
  uri   => 'Some unique uri to identify your request',
  proxy => 'The url that is in your Location in httpd.conf';

my $object = NameOfMySOAPedModule->new();
$object->a_method();
$object->an_other_method();

> MORE Importantly. how should I make sure the handler is invoked. I think
> it is not being invoked. I have also copied the package in the perls
> @INC path "/..../site_perl". The package has a handler function that
> should be invoked.

Try GETing the url.  Assuming you have LWP installed:

[mark@pate mark]$ GET http://2shortplanks.com/mod_soap
<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</h1>
405 Method Not Allowed
</BODY>
</HTML>

For a simple GET if the handler is being called you should get the 405 
(as you didn't issue a proper soap request.)

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              mark@twoshortplanks.com
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}