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

does soaplite support dbi-mysql?

Expand Messages
  • shihewang
    Hello, This is second time post the question- Does SOAP::Lie support DBI::mysql? I really care it. If anybody has the answer, please let me know. I created a
    Message 1 of 3 , Sep 15 11:23 AM
    • 0 Attachment
      Hello,
      This is second time post the question- Does SOAP::Lie support
      DBI::mysql? I really care it. If anybody has the answer, please let
      me know.
      I created a server-client, mysoap.cgi-test1.pl, does not work, while
      the other pair, hibye.cgi-hello.pl, in the same dir on the same
      machine works. And I copied the sub, search_db, from mysoap.cgi
      package, and put into test2.pl. test2.pl also works. See the codes
      and running result:

      mysoap.cgi hibye.cgi
      *****************************************
      *****************************************
      #!/usr/bin/perl -w #!/usr/bin/perl -w

      # use DBI;#tried this line use
      SOAP::Transport::HTTP;
      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      SOAP::Transport::HTTP::CGI -> dispatch_to
      ('Demo')
      -> dispatch_to('Mysoap') -> handle;
      -> handle;

      package Mysoap; package Demo;

      sub search_db{ sub hi {
      use DBI; return "hello,
      world";
      my $db_name = "mydb"; }
      my $passwd = "mypasswd";
      my $login = "mylogin"; sub bye {
      my $dbh =DBI->connect( return "goodbye,
      cruel world";
      "DBI:mysql:$db_name", $login, $passwd); }

      $sth=$dbh->prepare( 1;
      qq{select id from test where id =1});
      $sth -> execute;
      my $retval = $sth->fetchrow;
      return $retval;
      }
      1;
      *****************************************
      *****************************************


      test1.pl hello.pl
      *****************************************
      *****************************************
      #!/usr/bin/perl -w #!/usr/bin/perl -w

      use SOAP::Lite; use SOAP::Lite;
      my $soap=SOAP::Lite my $soap= SOAP::Lite
      ->uri('urn:Mysoap') -> uri('urn:Demo')
      ->proxy( ->proxy
      ('http://www.dept.univ.edu/'.
      'http://www.dept.univ.edu/'.' '~mylogin/cgi-
      bin/hibye.cgi')
      ~mylogin/cgi-bin/mysoap.cgi')
      ->search_db(); -> hi();
      my $result=$soap->result; my $result=$soap-
      >result."\n";
      print "result: $result\n"; print "Result:
      $result";
      *****************************************
      *****************************************



      Running result: Running result:
      *****************************************
      *****************************************
      %perl test1.pl %perl hello.pl
      Use of uninitialized value in Result: hello, world
      concatenation(.) or string at test1.pl %
      line 9.
      result:
      %
      *****************************************
      *****************************************



      Test2.pl
      *****************************************
      #!/usr/bin/perl -w

      sub search_db{
      use DBI;
      my $db_name = "mydb";
      my $passwd = "mypasswd";
      my $login = "mylogin";
      my $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->fetchrow;
      return $retval;
      }

      $result = search_db();
      print "result: $result\n";
      *****************************************


      Running result:
      *****************************************
      %perl test2.pl
      result: 1
      %
      *****************************************
    • rjray@blackperl.com
      SOAP::Lite does not support MySQL in the sense that there are any classes specifically designed for using MySQL. But that isn t the point; SOAP::Lite is
      Message 2 of 3 , Sep 15 1:57 PM
      • 0 Attachment
        SOAP::Lite does not "support" MySQL in the sense that there are any classes
        specifically designed for using MySQL. But that isn't the point; SOAP::Lite is
        designed to handle the SOAP-level elements of your application, while you use
        something like DBI+DBD::MySQL for the database layer. So yes, it is possible
        to use the two in tandem, but there is no SOAP::Lite-level support, anymore
        than there is for Oracle or Sybase or any other specific RDBMS.

        As to your example code, that is a puzzler. I agree with Duncan that you
        should consider changing "CGI" to "Daemon" in the creation of the server
        object, then you can run the server as a stand-alone script and add debugging.

        (You can also add debugging on-the-fly by using the -M switch to Perl:

        perl -MSOAP::Lite=trace mysoap.cgi

        perl -MSOAP::Lite=trace test1.pl

        This will enable the full tracing hooks, see the "SOAP::Trace" section in the
        manual page for SOAP::Lite to see the different options you can use.)

        Randy
        --
        """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
        Randy J. Ray rjray@...
        Campbell, CA rjray@...
        <A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>
      • Shihe Wang
        Randy, Thanks for the information. I mean if SOAP::Lite disable DBI or not by asking if SOAP::Lite supports DBI . As a fact when re-test my code added lines
        Message 3 of 3 , Sep 16 5:50 AM
        • 0 Attachment
          Randy, Thanks for the information.
          I mean if SOAP::Lite disable DBI or not by asking "if
          SOAP::Lite supports DBI". As a fact when re-test my
          code added lines as Duncan and/or Michael suggested,
          that in soap-lite server, dbi is searched in different
          way comparing with usual on command line.
          I use -M switch to trace mysoap.cgi, I found error msg
          "411 Length Required"
          Shawn Wang

          --- rjray@... wrote:
          > SOAP::Lite does not "support" MySQL in the sense
          > that there are any classes
          > specifically designed for using MySQL. But that
          > isn't the point; SOAP::Lite is
          > designed to handle the SOAP-level elements of your
          > application, while you use
          > something like DBI+DBD::MySQL for the database
          > layer. So yes, it is possible
          > to use the two in tandem, but there is no
          > SOAP::Lite-level support, anymore
          > than there is for Oracle or Sybase or any other
          > specific RDBMS.
          >
          > As to your example code, that is a puzzler. I agree
          > with Duncan that you
          > should consider changing "CGI" to "Daemon" in the
          > creation of the server
          > object, then you can run the server as a stand-alone
          > script and add debugging.
          >
          > (You can also add debugging on-the-fly by using the
          > -M switch to Perl:
          >
          > perl -MSOAP::Lite=trace mysoap.cgi
          >
          > perl -MSOAP::Lite=trace test1.pl
          >
          > This will enable the full tracing hooks, see the
          > "SOAP::Trace" section in the
          > manual page for SOAP::Lite to see the different
          > options you can use.)
          >
          > Randy
          > --
          >
          """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
          > Randy J. Ray
          > rjray@...
          > Campbell, CA
          > rjray@...
          > <A HREF="http://www.svsm.org">Silicon Valley Scale
          > Modelers</A>
          >


          __________________________________________________
          Do you Yahoo!?
          Yahoo! News - Today's headlines
          http://news.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.