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

Re: [soaplite] Does SOAP::Lite support DBI::mysql?

Expand Messages
  • Michael Goepper
    Hi, your code is working very well on my machine. It seem s, there s a runtime error somewhere (wrong DB login or something like this). If your mysoap.cgi dies
    Message 1 of 7 , Sep 15, 2002
      Hi,

      your code is working very well on my machine.

      It seem's, there's a runtime error somewhere (wrong DB login or something
      like this). If your mysoap.cgi dies (in case of a runtime error) -
      SOAP::Lite will create a SOAP-Fault. So you should react on faults in your
      test1.pl like this:

      --test1.pl---->8--------------schnipp----
      #!/usr/bin/perl -w

      use SOAP::Lite;
      my $soap=SOAP::Lite
      ->uri('urn:Mysoap')
      ->proxy( 'http://services.soap-portal.de/mysoap.cgi')
      -> on_fault(sub { my($soap, $res) = @_;
      die ref $res ? $res->faultstring : $soap->transport->status, "\n";
      })
      ->search_db();
      my $result=$soap->result;
      print "result: $result\n";
      --test1.pl---->8--------------schnapp----

      And then you'll see, what went wrong.

      Have fun,
      Michael

      ----------------------
      www.SOAP-PORTAL.DE
      ----------------------

      > 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. They do not work. While
      > the other pair, hibye.cgi-hello.pl, work in the same dir on the same
      > machine. 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 results(Sorry, codes post a moment ago not readable, now
      > re-post the code):
      >
      > 1. server: mysoap.cgi, client: test1.pl
      > mysoap.cgi
      > *****************************************
      > #!/usr/bin/perl -w
      >
      > # use DBI;#tried either with or without this line
      > use SOAP::Transport::HTTP;
      >
      > SOAP::Transport::HTTP::CGI
      > -> dispatch_to('Mysoap')
      > -> handle;
      >
      > package Mysoap;
      >
      > 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;
      > }
      > 1;
      > *****************************************
      >
      > test1.pl
      > *****************************************
      > #!/usr/bin/perl -w
      >
      > use SOAP::Lite;
      > my $soap=SOAP::Lite
      > ->uri('urn:Mysoap')
      > ->proxy( 'http://www.dept.univ.edu/~mylogin/cgi-bin/mysoap.cgi')
      > ->search_db();
      > my $result=$soap->result;
      > print "result: $result\n";
      > *****************************************
      >
      > Running result:
      > *****************************************
      > %perl test1.pl
      > Use of uninitialized value in concatenation (.) or string at test1.pl
      > line 9.
      > result:
      > %
      > *****************************************
      >
      [...]
      >
      > 3. copy the sub search_db from server mysoap.cgi, put into test2.pl
      > 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
      > %
      > *****************************************
      >
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
    • Duncan Cameron
      ... Can you run a SOAP::Lite daemon instead of a CGI? That will allow you to run it under debug and may help to see what s going on. Regards, Duncan Cameron
      Message 2 of 7 , Sep 15, 2002
        On 2002-09-15 shihewang wrote:
        >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.
        Can you run a SOAP::Lite daemon instead of a CGI? That will allow
        you to run it under debug and may help to see what's going on.

        Regards,
        Duncan Cameron
      • Duncan Cameron
        ... I should have added, given that it s not doing what you expect, your code should be a bit more defensive, e.g.: use SOAP::Lite; my $soap=SOAP::Lite
        Message 3 of 7 , Sep 15, 2002
          On 2002-09-15 Duncan Cameron wrote:
          >On 2002-09-15 shihewang wrote:
          >>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.
          >Can you run a SOAP::Lite daemon instead of a CGI? That will allow
          >you to run it under debug and may help to see what's going on.
          >
          I should have added, given that it's not doing what you expect,
          your code should be a bit more defensive, e.g.:

          use SOAP::Lite;
          my $soap=SOAP::Lite
          ->uri('urn:Mysoap')
          ->proxy( 'http://www.dept.univ.edu/~mylogin/cgi-bin/mysoap.cgi')
          ;
          my $som = $soap->search_db();
          die $soap->transport->status unless defined $som;

          if (defined $som->result) {
          print "result: ", $som->result, "\n";
          } else {
          my $faultcode = $som->faultcode;
          my $faultstring = $som->faultstring;
          my $detail = $som->faultdetail;
          # do something with $faultcode
          }

          Regards,
          Duncan Cameron
        • Shihe Wang
          Thanks a lot. I add the line into my code and run it. I get error message: %perl test1.pl faultcode- SOAP-ENV:Server faultstring- install_driver(mysql) failed:
          Message 4 of 7 , Sep 16, 2002
            Thanks a lot.
            I add the line into my code and run it. I get error
            message:
            %perl test1.pl
            faultcode- SOAP-ENV:Server

            faultstring- install_driver(mysql) failed: Can't
            locate DBD/mysql.pm in @INC (@INC contains:
            /usr/local/bin/mysql
            /usr/local/lib/perl5/5.8.0/sun4-solaris
            /usr/local/lib/perl
            5/5.8.0
            /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris
            /usr/local/lib/perl5/s
            ite_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at
            (eval 93) line 3.
            Perhaps the DBD::mysql perl module hasn't been fully
            installed,
            or perhaps the capitalisation of 'mysql' isn't right.
            Available drivers: ExampleP, Proxy.
            at
            /usr/local/etc/httpd/users/mylogin/public_html/cgi-bin/mysoap.cgi
            line 18

            detail- Use of uninitialized value in concatenation
            (.) or string at test1.pl line 27.

            %

            It is because the module, DBI::mysql, is not installed
            in the default dir.

            shihewang

            --- Duncan Cameron <dcameron@...> wrote:
            > On 2002-09-15 Duncan Cameron wrote:
            > >On 2002-09-15 shihewang wrote:
            > >>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.
            > >Can you run a SOAP::Lite daemon instead of a CGI?
            > That will allow
            > >you to run it under debug and may help to see
            > what's going on.
            > >
            > I should have added, given that it's not doing what
            > you expect,
            > your code should be a bit more defensive, e.g.:
            >
            > use SOAP::Lite;
            > my $soap=SOAP::Lite
            > ->uri('urn:Mysoap')
            > ->proxy(
            >
            'http://www.dept.univ.edu/~mylogin/cgi-bin/mysoap.cgi')
            > ;
            > my $som = $soap->search_db();
            > die $soap->transport->status unless defined $som;
            >
            > if (defined $som->result) {
            > print "result: ", $som->result, "\n";
            > } else {
            > my $faultcode = $som->faultcode;
            > my $faultstring = $som->faultstring;
            > my $detail = $som->faultdetail;
            > # do something with $faultcode
            > }
            >
            > Regards,
            > Duncan Cameron
            >
            >
            >
            >
            >
            >


            __________________________________________________
            Do you Yahoo!?
            Yahoo! News - Today's headlines
            http://news.yahoo.com
          • Shihe Wang
            Thanks. I ll try. But my problem seems DBI::mysql not installed in default diractory. ... __________________________________________________ Do you Yahoo!?
            Message 5 of 7 , Sep 16, 2002
              Thanks. I'll try.
              But my problem seems DBI::mysql not installed in
              default diractory.

              --- Duncan Cameron <dcameron@...> wrote:
              > On 2002-09-15 shihewang wrote:
              > >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.
              > Can you run a SOAP::Lite daemon instead of a CGI?
              > That will allow
              > you to run it under debug and may help to see what's
              > going on.
              >
              > Regards,
              > Duncan Cameron
              >
              >
              >
              >
              >


              __________________________________________________
              Do you Yahoo!?
              Yahoo! News - Today's headlines
              http://news.yahoo.com
            • Shihe Wang
              Thanks, Michael. I add your lines to my code and test it. I found the server side can t load dbi-mysql driver. However, on usual command line, as my test2.pl,
              Message 6 of 7 , Sep 16, 2002
                Thanks, Michael.
                I add your lines to my code and test it. I found the
                server side can't load dbi-mysql driver. However, on
                usual command line, as my test2.pl, the DBI::mysql
                works. So it seems as server, it searches DBI module
                in different way.
                Shawn Wang
                --- Michael Goepper <michael@...> wrote:
                > Hi,
                >
                > your code is working very well on my machine.
                >
                > It seem's, there's a runtime error somewhere (wrong
                > DB login or something
                > like this). If your mysoap.cgi dies (in case of a
                > runtime error) -
                > SOAP::Lite will create a SOAP-Fault. So you should
                > react on faults in your
                > test1.pl like this:
                >
                > --test1.pl---->8--------------schnipp----
                > #!/usr/bin/perl -w
                >
                > use SOAP::Lite;
                > my $soap=SOAP::Lite
                > ->uri('urn:Mysoap')
                > ->proxy(
                > 'http://services.soap-portal.de/mysoap.cgi')
                > -> on_fault(sub { my($soap, $res) = @_;
                > die ref $res ? $res->faultstring :
                > $soap->transport->status, "\n";
                > })
                > ->search_db();
                > my $result=$soap->result;
                > print "result: $result\n";
                > --test1.pl---->8--------------schnapp----
                >
                > And then you'll see, what went wrong.
                >
                > Have fun,
                > Michael
                >
                > ----------------------
                > www.SOAP-PORTAL.DE
                > ----------------------
                >
                > > 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.
                > They do not work. While
                > > the other pair, hibye.cgi-hello.pl, work in the
                > same dir on the same
                > > machine. 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 results(Sorry, codes post a moment ago not
                > readable, now
                > > re-post the code):
                > >
                > > 1. server: mysoap.cgi, client: test1.pl
                > > mysoap.cgi
                > > *****************************************
                > > #!/usr/bin/perl -w
                > >
                > > # use DBI;#tried either with or without this line
                > > use SOAP::Transport::HTTP;
                > >
                > > SOAP::Transport::HTTP::CGI
                > > -> dispatch_to('Mysoap')
                > > -> handle;
                > >
                > > package Mysoap;
                > >
                > > 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;
                > > }
                > > 1;
                > > *****************************************
                > >
                > > test1.pl
                > > *****************************************
                > > #!/usr/bin/perl -w
                > >
                > > use SOAP::Lite;
                > > my $soap=SOAP::Lite
                > > ->uri('urn:Mysoap')
                > > ->proxy(
                >
                'http://www.dept.univ.edu/~mylogin/cgi-bin/mysoap.cgi')
                > > ->search_db();
                > > my $result=$soap->result;
                > > print "result: $result\n";
                > > *****************************************
                > >
                > > Running result:
                > > *****************************************
                > > %perl test1.pl
                > > Use of uninitialized value in concatenation (.) or
                > string at test1.pl
                > > line 9.
                > > result:
                > > %
                > > *****************************************
                > >
                > [...]
                > >
                > > 3. copy the sub search_db from server mysoap.cgi,
                > put into test2.pl
                > > 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
                > > %
                > > *****************************************
                > >
                > >
                > >
                > > ------------------------ Yahoo! Groups Sponsor
                > ---------------------~-->
                > > Looking for a more powerful website? Try GeoCities
                > for $8.95 per month.
                > > Register your domain name (http://your-name.com).
                > More storage! No ads!
                > > http://geocities.yahoo.com/ps/info
                > >
                >
                http://us.click.yahoo.com/aHOo4D/KJoEAA/MVfIAA/W6uqlB/TM
                > >
                >
                ---------------------------------------------------------------------~->
                > >
                > > To unsubscribe from this group, send an email to:
                > > soaplite-unsubscribe@yahoogroups.com
                > >
                > >
                > >
                > > Your use of Yahoo! Groups is subject to
                > > http://docs.yahoo.com/info/terms/
                >
                >
                >


                __________________________________________________
                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.