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

Re: [soaplite] Subject : SoapLite as C# assembly using Perl Dev Kit

Expand Messages
  • Paul Kulchenko
    Hi Paul, ... which means client wants to call SoapTcpServer- demoCall and server doesn t have one. The problem is in configuration. ... Yet in your C# client
    Message 1 of 2 , Jan 9, 2003
    • 0 Attachment
      Hi Paul,

      > I had no message whatsoever of what went wrong, so I added trace

      I guess that's the message you're looking for:
      > Failed to locate method (demoCall) in class (SoapTcpServer)

      which means client wants to call SoapTcpServer->demoCall and server
      doesn't have one.

      The problem is in configuration.

      In your server code you allowed calls to SoapTcpServerPerl:

      > -> dispatch_to('SoapTcpServerPerl')

      And in your Perl client you use it correctly:

      > use SOAP::Lite
      > uri => 'SoapTcpServerPerl',

      Yet in your C# client for some reason (typo?) you have SoapTcpServer

      > use SOAP::Lite
      > uri => 'SoapTcpServer',

      If you change this line to "uri => 'SoapTcpServerPerl'" you shouldn't
      have problems running it.

      As to long names like 'MySoapLiteTest::SoapClient::SoapTcpClient' you
      can use them to:

      server:

      ->dispatch_to('MySoapLiteTest::SoapClient::SoapTcpClient');

      client:

      use SOAP::Lite
      uri => 'http://foo.com/MySoapLiteTest/SoapClient/SoapTcpClient',
      ...

      The host part of uri is irrelevant, but you should use one of the
      URIs you control to make it unique. The package name gets translated
      to URI by simply replacing '::' with slashes. That's default
      mechanism, but it's also possible to associate any URI with a
      package/object on a server side using dispatch_with method. Hope it
      helps a bit.

      Best wishes, Paul.

      --- "paulmasquelier <paulmasquelier@...>"
      <paulmasquelier@...> wrote:
      > Subject : problem with SoapLite as C# assembly using Perl Dev Kit
      >
      > Hello,
      >
      > I made a soaplite server and client package with Tcp as protocol;
      > this works fine.
      > I did a little reworking of these packages in order to convert them
      >
      > to C# assemblies, using Perl Dev Kit (for evaluation purposes to
      > download at www.activeperl.com).
      > The building of the assembly gave no problems, but running it
      > failed.
      >
      > Is there someone who also tried this ?
      >
      > I had no message whatsoever of what went wrong, so I added trace
      > prints in the soaplite packages to have a clue what was going on;
      > I could trace the problem till the function 'handle' in package
      > SOAP::Server (in Lite.pm) : the last eval in this function failed
      > (it
      > is obsure to me what really happened in this code), which produced
      > as
      > response message :
      > "<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      > xmlns:SOAP-
      > ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
      > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><SOAP-
      > ENV:Fault><faultcode xsi:type="xsd:string">SOAP-
      > ENV:Client</faultcode><faultstring xsi:type="xsd:string">Failed to
      > locate method (demoCall) in class (SoapTcpServer)
      > at /PerlApp/SOAP/Lite.pm line 2308."
      > (don't pay attention to the linenumber : this is different of yours
      >
      > due to the temporarily added prints)
      >
      > Here is the code of what I did :
      >
      > -------------------------------------
      > # SoapTcpServerPerl.pl : (I added 'Perl' to distinguish with
      > version
      > that will become a C# assemby)
      >
      > #!perl -w
      > #!d:\perl\bin\perl.exe
      >
      > # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul
      > Kulchenko -
      > -
      >
      > use SOAP::Transport::TCP;
      >
      > #$SIG{PIPE} = $SIG{INT} = 'IGNORE'; # don't want to die on 'Broken
      > pipe' or Ctrl-C
      >
      > package SoapTcpServerPerl;
      >
      > my $daemon;
      >
      > sub new()
      > {
      > $daemon = SOAP::Transport::TCP::Server
      > -> new (LocalAddr => 'localhost', LocalPort => 82, Listen => 5,
      > Reuse => 1)
      > -> dispatch_to('SoapTcpServerPerl')
      > ;
      > print "Contact to SOAP server at ", join(':', $daemon->sockhost,
      > $daemon->sockport), "\n";
      >
      > bless( {}, shift);
      > }
      >
      > sub handle()
      > {
      > $daemon->handle;
      > }
      >
      > sub demoCall {
      > return "call succeeded\n";
      > }
      >
      >
      > 1;
      >
      > -------------------------------------
      > # SoapTcpClientPerl.pl :
      >
      > #!perl -w
      > #!d:\perl\bin\perl.exe
      >
      > # -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul
      > Kulchenko -
      > -
      >
      > package SoapTcpClientPerl;
      >
      > use SOAP::Lite
      >
      > uri => 'SoapTcpServerPerl',
      > proxy => 'tcp://localhost:82/', # local tcp server
      >
      > on_fault => sub { my($soap, $res) = @_;
      > die ref $res ? $res->faultdetail : $soap->transport->status,
      > "\n";
      > }
      >
      > ;
      >
      > my $soaplite;
      >
      > sub new
      > {
      > $soaplite = SOAP::Lite->new;
      > bless({}, shift);
      > }
      >
      >
      > sub demoCall()
      > {
      > $soaplite->demoCall()->result;
      > }
      >
      >
      > 1;
      >
      > -------------------------------------
      > -------------------------------------
      >
      > These packages are tested using :
      > (tests work fine)
      >
      > #SoapTcpServerTester.pl :
      >
      > #!perl -w
      > #!d:\perl\bin\perl.exe
      >
      > use SoapTcpServerPerl;
      >
      > my $soaptcpserver = SoapTcpServerPerl->new;
      > $soaptcpserver->handle();
      >
      > 1;
      >
      > -----------
      >
      > #and SoapTcpClientTester.pl :
      >
      > #!perl -w
      > #!d:\perl\bin\perl.exe
      >
      > use SoapTcpClientPerl;
      >
      > my $soaptcpclient = SoapTcpClientPerl->new;
      > print $soaptcpclient->demoCall();
      >
      > 1;
      >
      > -------------------------------------
      > -------------------------------------
      >
      > Here is the version of the same, needed for conversion to C#
      > assembly
      >
      > # SoapTcpServer.pm (input for the PerlDevKit tool plc:)
      > # Makefile content :
      > #SoapTcpServer.dll : SoapTcpServer.pm
      > # plc -nologo -target library SoapTcpServer.pm
      >
      >
      > package MySoapLiteTest::SoapServer::SoapTcpServer;
      >
      > use namespace "System";
      >
      > use SOAP::Transport::TCP;
      >
      > =for interface
      > static SoapTcpServer();
      > =cut
      >
      > #$SIG{PIPE} = $SIG{INT} = 'IGNORE'; # don't want to die on 'Broken
      > pipe' or Ctrl-C
      >
      > my $daemon;
      >
      > sub SoapTcpServer()
      > {
      > $daemon = SOAP::Transport::TCP::Server
      > -> new (LocalAddr => 'localhost', LocalPort => 82, Listen => 5,
      > Reuse => 1)
      > -> dispatch_to('SoapTcpServerPerl')
      > ;
      > print "Contact to SOAP server at ", join(':', $daemon->sockhost,
      > $daemon->sockport), "\n";
      >
      > bless( {}, shift);
      > }
      >
      > =for interface
      > void handle();
      >
      === message truncated ===


      __________________________________________________
      Do you Yahoo!?
      Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
      http://mailplus.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.