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

575OLE (Win32::OLE) and SOAP::Lite

Expand Messages
  • Jörg Ziefle
    Jul 4, 2001
    • 0 Attachment
      I want to use MS Excel (on the server side) (via Win32::OLE) over
      SOAP::Lite. Unfortunately, I encountered some problems. Does anybody
      have an idea what could be the wrong (please see below)?

      This is the server on the Windows machine where Excel is sitting. It
      uses autodispatching to the directory where the Win32::OLE module is (in
      a subdirectory).


      use SOAP::Transport::HTTP;

      $daemon = SOAP::Transport::HTTP::Daemon
      -> new(
      LocalPort => 5000,
      Reuse => 1,
      )
      -> dispatch_to('C:\\perl\\site\\lib\\', '[\w:]+');

      print "Contact to SOAP server at ", $daemon->url, "\n";

      $daemon->handle;


      This is the client on the Unix machine. The program is working locally
      on the server (Windows) machine without SOAP::Lite.


      use strict;
      use Data::Dumper;

      use SOAP::Lite
      +trace => ['fault'],
      +autodispatch =>
      uri => 'http://128.61.33.168/',
      proxy => 'http://128.61.33.168:5000/',
      on_debug => sub { print @_ },
      on_fault => sub { print $_[1]->faultstring, "\n" },
      ;

      my $excel = Win32::OLE->new('Excel.Application') or die Win32::OLE->LastError;

      $excel->{Visible} = 1;
      $excel->{DisplayAlerts} = 0;
      my $book = $excel->Workbooks->Add or die Win32::OLE->LastError;
      my $sheet = $book->Worksheets(1) or die Win32::OLE->LastError;

      my @valueary = map { [ split ] } <DATA>;
      $sheet->Range('A1:B'.scalar @valueary)->{Value} = \@valueary;

      my $range1 = $sheet->Range('A1:A'.scalar @valueary);
      my $range2 = $sheet->Range('B1:B'.scalar @valueary);

      my $correl = $excel->Correl($range1, $range2) or die Win32::OLE->LastError;
      $excel->Quit;

      print $correl;

      __DATA__
      1 34
      2 45
      32 34
      5 7
      34 45
      5 7
      32 32
      46 8
      57 34
      34 84
      5 12
      45 34
      65 72
      34 82
      74 98
      23 2
      6 43
      35 65
      98 74
      4 45
      57 34
      23 3
      87 74
      23 25
      6 37
      77 2


      When I run this program, I see on the server side that Excel is launched
      (but it doesn't become visible). After quite a long time, I see the
      following message from the server daemon:

      Deep recursion on subroutine "SOAP::Serializer::encode_object" at
      C:/Perl/site/lib/SOAP/Lite.pm line 489.
      Deep recursion on subroutine "SOAP::Serializer::encode_hash" at
      C:/Perl/site/lib/SOAP/Lite.pm line 425.

      If I turn on logging on the client side, I see that the request from the
      client to the server is encoded (seems to be correct) and sent, but then
      nothing happens any more on the client side.

      On the other hand, I can run certain server side modules. For example,
      I can obtain all exported OLE constants via Win32::OLE::Const->Load();

      I have a normal ActiveState installation in c:\perl (Perl 5.6.1, Binary
      Build 626).

      Could it be that something fancy is happening during the

      use Win32::OLE;

      (which I can do in the non-SOAP version but not when using SOAP::Lite)?

      Is there any possibility to require/import a remote module when using
      SOAP, that is, to import the semantics of the module?

      Any hint and help on how to use SOAP::Lite with OLE is greatly
      appreciated,

      Jörg
    • Show all 4 messages in this topic