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

Basic WebService using SOAP::Lite

Expand Messages
  • Venkatraman S
    Apologies for messing up the Subject : its SOAP::Lite Venkatraman S wrote: Hi, I am facing a
    Message 1 of 3 , Sep 5, 2006
    • 0 Attachment
      Apologies for messing up the Subject  : its SOAP::Lite

      Venkatraman S <blizzard_venkat@...> wrote:
      Hi,

      I am facing a very-very basic problem while creating a WebService.

      I have a package VenkyHello that contains a subprog 'getNote' - i want to expose this as a webservice.

      $ cat VenkyHello.pm
      ------------ --------- --------- ---
      package VenkyHello;

      sub Hello { my ($s, $name) = @_;
          return 'Hello, ' . $name . "\n";
      }

      sub getNote{
               return  `venkget note 111`;
            #venkget is a prog that fetches a note 111
      }

      I am generating the WSDL using : VenkCreWSDL. pl
      $ cat VenkCreWSDL. pl
      #!/usr/local/ bin/perl
      BEGIN {push @INC,"/home/ venky/WSDL/ WSDL-Generator- 0.02/lib" ;}
      BEGIN {push @INC,"/home/ venky/HOOK/ Class-Hook/ lib";}
      use WSDL::Generator;

      my $init = {
              'schema_namesp' => 'http://host: port/cgi- bin/venky/ VenkyHello. xsd',
              'services'      => 'VenkyHello' ,
              'service_name'  => 'VenkyHello' ,
              'target_namesp' => 'http://host: port/cgi- bin/cr/venky/ ',
              'documentation' => 'Venky Simple Hello World SOAP Service',
              'location'      => 'http://host: port/cgi- bin/venky/ hello.cgi'
      };

      my $w = WSDL::Generator->new($init);
      VenkyHello->getNote();
      print $w->get(VenkyHello) ;

      I have attached the WSDL file generated by running the above file.

      $ cat hello.cgi
      ------------ --------- --------- ---
      #! /usr/local/bin/ perl
      BEGIN {push @INC,"/home/ venky/SOAP/ install/lib/ 5.8.1";}
      use SOAP::Transport: :HTTP;
      use VenkyHello;
      $|++;
      my $cgi = SOAP::Transport: :HTTP::CGI
                -> dispatch_to( 'VenkyHello' )
                -> handle
      ;

      Am accessing the webservice using the Client: VenkClient.pl
      $cat VenkClient.pl
      ------------ --------- --------- ---
      #!/usr/local/ bin/perl -w
      BEGIN {push @INC,"/home/ venky/SOAP/ install/lib/ 5.8.1";}
      use SOAP::Lite;
      my $service = SOAP::Lite->service('file: ./VenkyHello. wsdl');
      $service->outputxml('true' );
      print "hello\n";
      my $result = $service->getNote();
      print $result, "\n";
      1;

      Am getting the following errors alternatively , when i try to run the Client:
      <faultcode>soap:Client</faultcode>
      <faultstring>Failed to access class (cgi-bin::cr: :venky) at /home/venky/ SOAP/install/ lib/5.8.1/ SOAP/Lite. pm line 2462.
      </faultstring>

      AND

      <faultcode>soap:VersionMismatc h</faultcode>
      <faultstring>Wrong SOAP version specified. Supported versions:
        1.1 (http://schemas. xmlsoap.org/ soap/envelope/ )
        1.2 (http://www. w3.org/2003/ 05/soap-envelope )
      </faultstring>


      Kindly provide your valuable feedbacks asap.

      Regards,
      Venky

      Stay in the know. Pulse on the new Yahoo.com. Check it out.


      Stay in the know. Pulse on the new Yahoo.com. Check it out.

    • Venkatraman S
      Any inputs ?? Kindly do provide your valuable suggestions please. --vEnkAt Venkatraman S wrote:
      Message 2 of 3 , Sep 6, 2006
      • 0 Attachment
        Any inputs ?? Kindly do provide your valuable suggestions please.

        --vEnkAt

        Venkatraman S <blizzard_venkat@...> wrote:
        Apologies for messing up the Subject  : its SOAP::Lite

        Venkatraman S <blizzard_venkat@ yahoo.co. in> wrote:
        Hi,

        I am facing a very-very basic problem while creating a WebService.

        I have a package VenkyHello that contains a subprog 'getNote' - i want to expose this as a webservice.

        $ cat VenkyHello.pm
        ------------ --------- --------- ---
        package VenkyHello;

        sub Hello { my ($s, $name) = @_;
            return 'Hello, ' . $name . "\n";
        }

        sub getNote{
                 return  `venkget note 111`;
              #venkget is a prog that fetches a note 111
        }

        I am generating the WSDL using : VenkCreWSDL. pl
        $ cat VenkCreWSDL. pl
        #!/usr/local/ bin/perl
        BEGIN {push @INC,"/home/ venky/WSDL/ WSDL-Generator- 0.02/lib" ;}
        BEGIN {push @INC,"/home/ venky/HOOK/ Class-Hook/ lib";}
        use WSDL::Generator;

        my $init = {
                'schema_namesp' => 'http://host: port/cgi- bin/venky/ VenkyHello. xsd',
                'services'      => 'VenkyHello' ,
                'service_name'  => 'VenkyHello' ,
                'target_namesp' => 'http://host: port/cgi- bin/cr/venky/ ',
                'documentation' => 'Venky Simple Hello World SOAP Service',
                'location'      => 'http://host: port/cgi- bin/venky/ hello.cgi'
        };

        my $w = WSDL::Generator->new($init);
        VenkyHello->getNote();
        print $w->get(VenkyHello) ;

        I have attached the WSDL file generated by running the above file.

        $ cat hello.cgi
        ------------ --------- --------- ---
        #! /usr/local/bin/ perl
        BEGIN {push @INC,"/home/ venky/SOAP/ install/lib/ 5.8.1";}
        use SOAP::Transport: :HTTP;
        use VenkyHello;
        $|++;
        my $cgi = SOAP::Transport: :HTTP::CGI
                  -> dispatch_to( 'VenkyHello' )
                  -> handle
        ;

        Am accessing the webservice using the Client: VenkClient.pl
        $cat VenkClient.pl
        ------------ --------- --------- ---
        #!/usr/local/ bin/perl -w
        BEGIN {push @INC,"/home/ venky/SOAP/ install/lib/ 5.8.1";}
        use SOAP::Lite;
        my $service = SOAP::Lite->service('file: ./VenkyHello. wsdl');
        $service->outputxml('true' );
        print "hello\n";
        my $result = $service->getNote();
        print $result, "\n";
        1;

        Am getting the following errors alternatively , when i try to run the Client:
        <faultcode>soap:Client</faultcode>
        <faultstring>Failed to access class (cgi-bin::cr: :venky) at /home/venky/ SOAP/install/ lib/5.8.1/ SOAP/Lite. pm line 2462.
        </faultstring>

        AND

        <faultcode>soap:VersionMismatc h</faultcode>
        <faultstring>Wrong SOAP version specified. Supported versions:
          1.1 (http://schemas. xmlsoap.org/ soap/envelope/ )
          1.2 (http://www. w3.org/2003/ 05/soap-envelope )
        </faultstring>


        Kindly provide your valuable feedbacks asap.

        Regards,
        Venky

        Stay in the know. Pulse on the new Yahoo.com. Check it out.


        Stay in the know. Pulse on the new Yahoo.com. Check it out.


        All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

      Your message has been successfully submitted and would be delivered to recipients shortly.