Loading ...
Sorry, an error occurred while loading the content.
 

Re: [soaplite] dispatch_to problem

Expand Messages
  • Paul Kulchenko
    Hi John, Are you sure you ve included EXACTLY the file that you re using? ... --^^^^ ... It has to be SOAP::...., and it looks like in the code you re using
    Message 1 of 6 , Oct 29, 2002
      Hi John,

      Are you sure you've included EXACTLY the file that you're using?

      > SOAP::Transport::HTTP::CGI->dispatch_to('Echo')
      --^^^^

      > I'm getting an error: "Can't locate object method "dispatch_to" via
      > package "Soap::Transport::HTTP::CGI" at
      -----------^^^^

      It has to be SOAP::...., and it looks like in the code you're using
      it's not.

      Best wishes, Paul.

      --- jaralston3 <jaralston3@...> wrote:
      > I'm a newbie to Perl as well as SOAP, so I assume my problem is in
      > something I don't understand about Perl packages.
      >
      > I'm using ActivePerl 5.6.0 running on Win98 with PWS. I have a
      > service request dispatcher named echo.cgi with this in it:
      >
      > #!perl
      > use Echo;
      > use SOAP::Transport::HTTP;
      > SOAP::Transport::HTTP::CGI
      > ->dispatch_to('Echo')
      > ->handle;
      >
      > "Echo" is a service handler package in echo.pm.
      >
      > I'm getting an error: "Can't locate object method "dispatch_to" via
      > package "Soap::Transport::HTTP::CGI" at
      > C:\Inetpub\wwwroot\cgi-bin\echo.cgi line 9.
      > in echo.cgi".
      >
      > The thing is, I can't find sub dispatch_to in any of the .pm files
      > under /perl/site/lib/SOAP or any of its subdirectories. Package
      > SOAP::Transport::HTTP::CGI in SOAP/Transport/HTTP.pm has
      > sub new
      > sub handle
      > sub DESTROY
      > but no sub dispatch_to.
      >
      > Can anyone give me some education and pointers on this. I've
      > searched the archives and looked all over the SOAP-Lite site, but
      > haven't found anything to help.
      >
      > tia
      > John
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do you Yahoo!?
      HotJobs - Search new jobs daily now
      http://hotjobs.yahoo.com/
    • John Ralston
      Thanks, Randy, for your response. Comments below. ... If I could answer this definitively, I
      Message 2 of 6 , Oct 30, 2002
        <this was posted once, but did not seem to make it to the list>

        Thanks, Randy, for your response. Comments below.

        > Was SOAP::Lite properly installed? SOAP::Transport::HTTP::CGI inherits from
        > the SOAP::Server class, which is defined in the SOAP::Lite module.

        If I could answer this definitively, I probably wouldn't be having my
        problem. But I do know that Lite.pm is in /site/lib/SOAP and its various
        packages are below.

        > Many of the accessor methods (which is what dispatch_to really is, an
        accessor
        > to the dispatch table) are defined using direct-manipulation of the symbol
        > table with either closures or eval.

        I see what you mean. I found "dispatch_to in Lite.pm and it looks like it
        is setting up sort of a pointer to the handler, sub echo in Echo in my
        case. My first thought, then, is that echo can't be found. But the
        error.log below seems to indicate that it did do its job.

        > Can you send us the actual "Echo.pm" file?

        Here is everything.

        #=============================================
        # request handler in /inetpub/wwwroot/cgi-bin
        #=============================================
        #!perl
        # echo.pm

        package Echo;

        use strict;

        sub echo {
        my ($self, @args) = @_;
        return join(",", @args);
        }
        return 1;

        #===============================================
        # request dispatcher in /inetpub/wwwroot/cgi-bin
        #===============================================
        #!perl -w
        # echo.cgi

        use Echo;
        use Soap::Transport::HTTP;

        Soap::Transport::HTTP::CGI
        ->dispatch_to('Echo')
        ->handle;

        #=================================================
        # client also in /inetpub/wwwroot/cgi-bin
        # invoked as: perl echo_client.pl "test phrase"
        #=================================================
        #!perl
        #echo_client.pl

        use SOAP::Lite+trace=>'debug';

        open STDERR, '>', "error.log";

        $host="http://laptop/cgi-bin/echo.cgi";
        $ns="urn:Echo";
        $phrase=shift;

        my $soap = SOAP::Lite->readable(1)->uri($ns)->proxy($host);
        my $som = $soap->echo(SOAP::Data->name("whatToEcho"=>"$phrase"));
        print "The response from the server was: " . $som->result . "\n";

        #========================================
        # error.log generated by client
        #========================================
        <error.log>

        SOAP::Transport::HTTP::Client::send_receive: POST
        http://laptop/cgi-bin/echo.cgi
        Accept: text/xml
        Accept: multipart/*
        Content-Length: 536
        Content-Type: text/xml; charset=utf-8
        SOAPAction: "urn:Echo#echo"

        <?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:echo xmlns:namesp1="urn:Echo"
        >
        <whatToEcho xsi:type="xsd:string"
        >test
        phrase</whatToEcho></namesp1:echo></SOAP-ENV:Body></SOAP-ENV:Envelope>
        SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 502 (Bad Gateway)
        Gateway Error
        Date: Thu, 31 Oct 2002 08:35:03 GMT
        Server: Microsoft-IIS/4.0
        Content-Length: 345
        Content-Type: text/html
        Client-Date: Thu, 31 Oct 2002 08:35:03 GMT
        Client-Peer: 192.168.2.36:80
        Title: Error in CGI Application

        <head><title>Error in CGI Application</title></head>
        <body><h1>CGI Error</h1>The specified CGI application misbehaved by not
        returning a complete set of HTTP headers. The headers it did return
        are:<p><p><pre>Can't locate object method "dispatch_to" via package
        "Soap::Transport::HTTP::CGI" at C:\Inetpub\wwwroot\cgi-bin\echo.cgi line 7.

        </pre>
        502 Gateway Error at echo_client.pl line 13

        </error.log>

        tia for taking the time to look at all this. I appreciate your advice.

        John
      • Randy J. Ray
        ... As Paul pointed out, Soap should be SOAP . Randy -- rjray@blackperl.com http://www.rjray.org http://www.svsm.org Any spammers
        Message 3 of 6 , Oct 30, 2002
          On 2002.10.30 16:19 John Ralston wrote:

          > #===============================================
          > # request dispatcher in /inetpub/wwwroot/cgi-bin
          > #===============================================
          > #!perl -w
          > # echo.cgi
          >
          > use Echo;
          > use Soap::Transport::HTTP;
          >
          > Soap::Transport::HTTP::CGI
          > ->dispatch_to('Echo')
          > ->handle;

          As Paul pointed out, "Soap" should be "SOAP".

          Randy
          --
          rjray@... http://www.rjray.org http://www.svsm.org

          Any spammers auto-extracting addresses from this message will definitely want
          to include uce@... and report@...
        • John Ralston
          Randy - I can t believe it ! I totally missed what Paul was driving at. I said I was a Perl newbie. Bet you never could have guessed most of
          Message 4 of 6 , Oct 30, 2002
            Randy -

            I can't believe it <slap on forehead>! I totally missed what Paul was
            driving at. I said I was a Perl newbie. Bet you never could have guessed
            most of my work is VB on Windows.

            Much thanks to you and Paul. Works like a charm.

            Regards,
            John

            At 04:32 PM 10/30/02 -0800, you wrote:
            >On 2002.10.30 16:19 John Ralston wrote:
            >
            >>#===============================================
            >># request dispatcher in /inetpub/wwwroot/cgi-bin
            >>#===============================================
            >>#!perl -w
            >># echo.cgi
            >>use Echo;
            >>use Soap::Transport::HTTP;
            >>Soap::Transport::HTTP::CGI
            >>->dispatch_to('Echo')
            >>->handle;
            >
            >As Paul pointed out, "Soap" should be "SOAP".
            >
            >Randy
            >--
            >rjray@... http://www.rjray.org http://www.svsm.org
            >
            >Any spammers auto-extracting addresses from this message will definitely want
            >to include uce@... and report@...
          Your message has been successfully submitted and would be delivered to recipients shortly.