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

passing array/hash looking stuff from SOAP::Lite client to server

Expand Messages
  • perlmedian
    I am trying to write and test a service I am writing in SOAP::Lite. I have had a little exposure to SOAP::Lite as a client to .NET server. But I want the data
    Message 1 of 1 , Jun 5, 2003
    • 0 Attachment
      I am trying to write and test a service I am writing in SOAP::Lite. I
      have had a little exposure to SOAP::Lite as a client to .NET server.
      But I want the data that's going to be passed to the server to be
      distinguishable from each other.

      Here's the code that works that I have so far (some of it may be
      wrapped around):

      ### CLIENT code soap_client.pl
      use strict;
      use warnings;
      use SOAP::Lite;

      my $soap = SOAP::Lite->new(
      uri => $URI, # urn:FileInfo
      proxy => $PROXY, # server cgi file
      );

      my @stuff = qw(
      src/accounting/Accounting.cc
      src/products/Products.cc
      include/calculator.h
      );

      # SOAP method (as defined on server)
      my $files = SOAP::Data->name('files' => join "\n", @stuff )->type
      ('string')->uri($URI);
      ## I want to get rid of the join from the above
      my $client = SOAP::Data->name('client' => 'IADB')->type('string')->uri
      ($URI);
      my $release = SOAP::Data->name('release' => 'V3.4.5')->type('string')-
      >uri($URI);
      my $os = SOAP::Data->name('os' => 'NT 4')->type('string')->uri($URI);

      my $response = $soap->getFileRevision($files, $client, $release, $os);

      ## response
      if ($response->fault) {
      print "ERROR CODE:", $response->faultcode, " ",
      $response->faultstring, "\n";
      } else {
      print $response->result() , "\n\n";
      }


      ########### SERVER CODE FileData.cgi
      use strict;
      use warnings;
      use SOAP::Transport::HTTP;

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


      package FileInfo;

      sub getFileRevision {

      my($self, @params) = @_;

      open(FILE, ">", "/usr/log");

      print FILE "@params";

      close FILE;

      return SOAP::Data->name('data')->value($params[0])->type('string')-
      >uri('urn:FileInfo');

      } ################################# END getFileRevision

      ###### END CODE

      The @params are the values from the client but I want to be able to
      access the values by name (client/release/etc.) also I want the files
      to be an array (or XML equivelent) instead of a join array into a
      string.

      I am highly adept at using XML::Parser among other XML modules so XML
      is not a problem.

      Can anyone help me from the working above example? I am sure it would
      be benifical to others to learn from this, as well as teach me what I
      should be doing.

      Thank you in advance,
    Your message has been successfully submitted and would be delivered to recipients shortly.