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

5580Basic WebService using SOAP::Lite

Expand Messages
  • Venkatraman S
    Sep 5, 2006
    • 0 Attachment
      Apologies for messing up the Subject  : its SOAP::Lite

      Venkatraman S <blizzard_venkat@...> wrote:

      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);
      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";

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


      <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 )

      Kindly provide your valuable feedbacks asap.


      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.

    • Show all 3 messages in this topic