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

TCP + SSL as standalone SOAP-Server

Expand Messages
  • nsowen
    Hello people, I m trying to setup a simple SOAP-Server using the TCP transport module. server.pl ... use SOAP::Transport::TCP; my $daemon =
    Message 1 of 1 , Aug 17, 2004
    • 0 Attachment
      Hello people,

      I'm trying to setup a simple SOAP-Server using the TCP transport
      module.

      server.pl
      ---------

      use SOAP::Transport::TCP;

      my $daemon = SOAP::Transport::TCP::Server->new(
      LocalAddr => '192.168.0.2',
      LocalPort => 8001,
      Listen => 1,
      SSL_use_cert => 1,
      SSL_key_file => 'soap_server.key',
      SSL_cert_file => 'soap_server.cert');

      $daemon->dispatch_to('/var/perl_modules/');

      print "SOAP TCP server listening...\n";
      print " Host: ", $daemon->sockhost, "\n";
      print " Port: ", $daemon->sockport, "\n";

      $daemon->handle();




      client.pl
      ----------

      use SOAP::Lite;
      my $client = SOAP::Lite->new();
      $client->uri('urn:MyModules');
      $client->proxy('tcp://192.168.0.2:8001');

      my $som = $client->mkdir("/tmp/test1");

      if ($som) {
      if ($som->fault) {
      print $som->faultcode."\n";
      print $som->faultstring."\n";
      } else {
      print $som->result;
      }
      }

      exit(0);

      When I run first the server and then the client, the server throws an
      error message like that:

      SOAP TCP server listening...
      Host: 192.168.0.2
      Port: 8001
      Use of uninitialized value in pattern match (m//) at
      /usr/local/share/perl/5.8.3/SOAP/Lite.pm line 1704.
      Use of uninitialized value in pattern match (m//) at
      /usr/local/share/perl/5.8.3/SOAP/Lite.pm line 1704.
      Use of uninitialized value in subroutine entry at
      /usr/local/lib/perl/5.8.3/XML/Parser/Expat.pm line 474.

      After some debugging output I found out that the data-variable, which
      should be the XML-data, is empty.

      Now here's the funny thing: If I run the client once again without
      closing the server-script, the whole SOAP interaction works just fine.
      ALSO with the same setup excluding all SSL-statements it just works
      fine.

      I figured it might be some problem with the SSL-handshake, because
      only the first SOAP request fails. I'm using:

      - SOAP-Lite-0.60a
      - Net_SSLeay.pm-1.26 and Net_SSLeay.pm-1.25 (tried both)
      - IO-Socket-SSL-0.96
      - XML-Parser-2.34

      Here's a trace from the client program:

      ---
      Unquoted string "trace" may clash with future reserved word at
      soap_mkdir_client.pl line 4.
      SOAP::Transport::new: ()
      SOAP::Serializer::new: ()
      SOAP::Deserializer::new: ()
      SOAP::Parser::new: ()
      SOAP::Lite::new: ()
      SOAP::Transport::TCP::Client::new: ()
      SOAP::Lite::call: ()
      SOAP::Serializer::envelope: ()
      SOAP::Serializer::envelope: mkdir /tmp/test1
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Transport::TCP::Client::send_receive: <?xml version="1.0"
      encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
      /soap/encoding/"><SOAP-ENV:Body><namesp1:mkdir
      xmlns:namesp1="urn:MyModules"><c-gensym3
      xsi:type="xsd:string">/tmp/test1</c-gensym3></name
      sp1:mkdir></SOAP-ENV:Body></SOAP-ENV:Envelope>
      SOAP::Transport::TCP::Client::send_receive:
      SOAP::Lite::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Parser::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Transport::TCP::Client::DESTROY: ()

      ---

      Thanks in advance ;-) If you need any other debugging informationen
      please let me know.

      Nils
    Your message has been successfully submitted and would be delivered to recipients shortly.