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

soap database connectivity using SOAP::LITE and DBI

Expand Messages
  • bai jing
    I am trying the SOAP connectivity using SOAP::LITE and DBI, it doesn t work , no response and error message at all. could anyone help? here is my code server
    Message 1 of 1 , Jul 24 9:41 AM
    • 0 Attachment

      I am trying the SOAP connectivity using SOAP::LITE and DBI,  it doesn't work , no response and error message at all. could anyone help?

      here is my code

      server side: soaphello2.pl

      //////////////////////

      #!d:\perl\bin\perl.exe
      # SOAP handler for HelloService, using CGI

      use SOAP::Transport::HTTP;
      use CGI qw(:standard);
      SOAP::Transport::HTTP::CGI
       -> dispatch_to('HelloService')
       -> handle
      ;
      exit;

      #--------------------------------------------
      # The Hello service
      # This could be in a perl module, in an @INC directory

      package HelloService;

      sub sayHello {
        shift;
        return "Hello, ".shift;
      }

      sub sayWelcome {
        return "Greetings & felicitations";
      }

      #add other methods here ....

      sub querying {
      ## TRY TO CONNECT THE DATABASE

      use DBI;
      $database=DBI->connect("DBI:ODBC:POLITE", "SYSTEM", "SYSTEM");# or die "\n Connection error($DBI::err): $DBI::errstr\n";
      return "test1";
      $query='select * from yeti';

      $statement=$database->prepare($query);

      $statement->execute;

      foreach $result (@result)
      {

      print "<b>$result\n";

      }
      $statement->finish;
      $database->disconnect();
      return $result;
      }

      ////////////////////////////

      the clientside code: clienthello.pl

      # SOAP client

      use SOAP::Lite;

      $something = SOAP::Lite
       ->uri('urn:HelloService')        # package & module name
       ->proxy ('http://localhost/cgi-bin/soaphello2.pl') # cgi script to call the service
       ->sayHello("fred")    # the service
       ->result ;     # the result!

      print "$something\n";

       

      $something = SOAP::Lite
       ->uri('urn:HelloService')        # package & module name
       ->proxy ('http://localhost/cgi-bin/soaphello2.pl') # cgi script to call the service
       ->sayWelcome()     # another service
       ->result ;     # the result!

      print "$something\n";


      $something = SOAP::Lite
       ->uri('urn:HelloService')        # package & module name
       ->proxy ('http://localhost/cgi-bin/soaphello2.pl') # cgi script to call the service
       ->querying()     # another service
       ->result ;     # the result!

      print "$something\n";

      ///////////////////////////

      sorry for the long code above, anything wrong here?

      best wishes to all, betsy



      Do You Yahoo!?
      Yahoo! Health - Feel better, live better
    Your message has been successfully submitted and would be delivered to recipients shortly.