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

1813Re: [soaplite] Do SOAP::Lit and CGI support database-MySQL?

Expand Messages
  • Duncan Cameron
    Sep 9, 2002
      On 2002-09-10 shihewang wrote:
      >Hello,
      >
      >Anybody knows if SOAP::Lite and CGI support database, say MySQL?
      >Please let me know.
      >
      >My test results are negative. I am not sure if my codes are correct.
      >1. SOAP::Lite
      >**************************************************************
      >**** Server
      >**************************************************************
      >#!/usr/bin/perl -w
      ># file: mysoap.cgi
      >
      > use DBI;
      > use SOAP::Transport::HTTP;
      >
      > SOAP::Transport::HTTP::CGI
      > -> dispatch_to('Mysoap')
      > -> handle;
      >
      > package Mysoap;
      >
      > sub search_db
      > {
      > use DBI;
      > my $db_name = "";
      > my $passwd = "";
      > my $login = "";
      > $dbh =DBI->connect("DBI:mysql:$db_name", $login, $passwd)
      >
      > $sth=$dbh->prepare(qq{select id from test where id =1});
      > $sth -> execute;
      > my $retval = $sth->fecthrow;
      > return $retval;
      > }
      >
      >1;
      >#end mysoap.cgi

      Are you getting any server errors?
      I suggest putting the Mysoap package either *before* the
      call to SOAP:Transport (and then switching back to the main package)
      or into a separate file.

      >**************************************************************
      >**** Client
      >**************************************************************
      >#!/usr/bin/perl -w
      ># file: test.pl
      >
      >use SOAP::Lite;
      >my $soap =SOAP::Lite
      > ->uri("urn:Mysoap")
      > ->proxy("http://www.dept.university.edu/~mylogin/cgi-
      >bin/mysoap.cgi")
      > ->hi();

      There is no hi() method in Mysoap package.

      Regards,
      Duncan Cameron
    • Show all 5 messages in this topic