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

Re: [soaplite] SOAP::Lite server side (some direction needed)

Expand Messages
  • Duncan Cameron
    ... It looks like your client is sending four parameters, three named scalars and an array. If you want the keys and values to be kept then you need to send a
    Message 1 of 5 , Jun 16, 2003
    • 0 Attachment
      On 2003-06-16 20:11:00 perlmedian <perlmedian@...> wrote:

      >Okay. I posted previously with no avail. But after a few days of
      >research I finally have some decent progress. Here is my last problem
      >to my project, and it's near impossible to debug a server:
      >
      >I have setup and server using the HTTP implementation of SOAP::Lite.
      >
      >Here's the code (nice and short):
      >----CODE----
      >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/njancesk/log");
      >
      >use Data::Dumper;
      >print FILE Dumper(\@params);
      >
      >close FILE;
      >
      >return
      > SOAP::Data->name('data')
      > ->value('ok')
      > ->type('string')
      > ->uri('urn:FileInfo');
      >} #### END sub getFileRevision
      >----END-CODE----
      >
      >The problem I am having is that the @params contains only the values
      >that I am seeking. I was hoping for something that looked more like a
      >hash key-value pairing. Is there something I am missing?
      >
      >Here is example SOAP request sent:
      >----SOAP-REQUEST----
      ><?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
      > >
      > <namesp1:getFileRevision xmlns:namesp1="urn:FileInfo"
      > >
      > <os xsi:type="xsd:string"
      > >NT 4</os>
      > <release xsi:type="xsd:string"
      > >V3.4</release>
      > <client xsi:type="xsd:string"
      > >XYZ</client>
      > <files SOAP-ENC:arrayType="xsd:string[3]" xsi:type="SOAP-
      >ENC:Array"
      > >
      > <item xsi:type="xsd:string"
      > >src/Accounting.cc</item>
      > <item xsi:type="xsd:string"
      > >src/valvirttrade.cc</item>
      > <item xsi:type="xsd:string"
      >
      >>include/sdcalculator.h</item></files></namesp1:getFileRevision></SOAP
      >-ENV:Body></SOAP-ENV:Envelope>
      >----END-SOAP-REQUEST----
      >
      >And an example of what shows up in the log file:
      >---LOG---
      >$VAR1 = [
      > 'NT 4',
      > 'V3.4',
      > 'XYZ',
      > [
      > 'src/Accounting.cc',
      > 'src/valvirttrade.cc',
      > 'include/sdcalculator.h'
      > ]
      > ];
      >---LOG--
      >
      >I was looking for something along the lines of:
      >$VAR1 = [
      > 'os',
      > 'NT 4',
      > 'release',
      > 'V3.4',
      > 'client',
      > 'XYZ',
      > 'files',
      > [
      > 'src/Accounting.cc',
      > 'src/valvirttrade.cc',
      > 'include/sdcalculator.h'
      > ]
      > ];
      >
      >Does anyone see what I am missing from my code? Is there some
      >documentation/article/chapter that I missed? If I change the order of
      >the data it changes the order passed to the method invocation.
      >Obviously I am going to implement a return of data, but for now I was
      >just trying to get the data in a form I can use.
      >
      It looks like your client is sending four parameters, three named scalars
      and an array. If you want the keys and values to be kept then you need to
      send a hash as a reference. Something like this in your client

      $som = $soap->mymethod( {os => 'NT4', release => 'V3.4', client => 'XYZ'},
      ['src/Accounting.cc', 'src/valvirttrade.cc', 'include/sdcalculator.h' ]
      );

      Then in your server

      my ($self, $hashref, $arrayref) = @_;
      ..

      Entirely untested, but you should get the idea.

      Regards
      Duncan
    • sharmila_pillai
      Hi, I am trying to send a hashmap to a soaplite server. Client code (snippet) looks like: %params = ( program = fasta3 ); ... my $som =
      Message 2 of 5 , Aug 8, 2003
      • 0 Attachment
        Hi,

        I am trying to send a hashmap to a soaplite server.

        Client code (snippet) looks like:

        %params = ("program" => "fasta3");
        ...
        my $som = $soap->testhash(SOAP::Data->type(map=>\%params)-
        >name('params'));
        print $som=>result."\n";

        The soap request looks like:
        <namesp1:testhash xmlns:namesp1="TestHash">
        <params xsi:type="apachens:Map">
        <item>
        <key xsi:type="xsd:string">program</key>
        <value xsi:type="xsd:string">fasta3</value>
        </item>
        </params>
        </namesp1:testhash>

        The server code snippet:

        my ($self, %params) =@_;
        my $value = $params{"program"};
        ...

        I have gone through the mails here and think the above server code is right. But I
        don't seem to be able to access the hash. What am I doing wrong? Is there some
        module I am missing?

        Will appreciate any help.
        TIA,
        Sharmila.
      • Thom Eden
        Sharmila, I am doing something similar in nmy SOAP server. Here is my client call: my $inputSoapParam = SOAP::Data - name( inputStruct ) - type( SOAPStruct )
        Message 3 of 5 , Aug 8, 2003
        • 0 Attachment
          Sharmila,

          I am doing something similar in nmy SOAP server. Here is my client call:

          my $inputSoapParam = SOAP::Data
          -> name('inputStruct')
          -> type('SOAPStruct')
          -> value(\%xmlInput)
          ;

          my $response = SOAP::Lite
          -> readable(1)
          -> uri($uri)
          -> proxy($PROXY)
          -> getDecision($inputSoapParam)
          ;

          and here is the catcher's mitt in the server:

          sub getDecision {
          my ($obj, $in) = @_;
          my $out = &do_something(%{$in});
          }

          and it works fine for me. I haven't done any performance testing, though, so I am not sure how optimal this is...

          Thom Eden

          ---------- Original Message ----------------------------------
          From: "sharmila_pillai" <sharmila_pillai@...>
          Date: Fri, 08 Aug 2003 11:13:18 -0000

          >Hi,
          >
          > I am trying to send a hashmap to a soaplite server.
          >
          >Client code (snippet) looks like:
          >
          >%params = ("program" => "fasta3");
          >...
          >my $som = $soap->testhash(SOAP::Data->type(map=>\%params)-
          >>name('params'));
          >print $som=>result."\n";
          >
          >The soap request looks like:
          ><namesp1:testhash xmlns:namesp1="TestHash">
          > <params xsi:type="apachens:Map">
          > <item>
          > <key xsi:type="xsd:string">program</key>
          > <value xsi:type="xsd:string">fasta3</value>
          > </item>
          > </params>
          ></namesp1:testhash>
          >
          >The server code snippet:
          >
          >my ($self, %params) =@_;
          >my $value = $params{"program"};
          >...
          >
          >I have gone through the mails here and think the above server code is right. But I
          >don't seem to be able to access the hash. What am I doing wrong? Is there some
          >module I am missing?
          >
          >Will appreciate any help.
          >TIA,
          >Sharmila.
          >
          >
          >
          >
          >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/
          >
          >
          >
        • Byrne Reese
          My experience is that this works great for SOAP::Lite to SOAP::Lite servers and clients, but not for the WS community at large. I personally would avoid
          Message 4 of 5 , Aug 8, 2003
          • 0 Attachment
            My experience is that this works great for SOAP::Lite to SOAP::Lite
            servers and clients, but not for the WS community at large.

            I personally would avoid SOAPStructs like the plague. :)

            Instead, you relegate yourself to a more "manual" process for deriving
            your XML instead of using native Perl data structures.

            Check out: http://majordojo.com/soaplite/ for some HOWTOs on this topic.

            On Fri, 2003-08-08 at 08:54, Thom Eden wrote:
            > Sharmila,
            >
            > I am doing something similar in nmy SOAP server. Here is my client
            > call:
            >
            > my $inputSoapParam = SOAP::Data
            > -> name('inputStruct')
            > -> type('SOAPStruct')
            > -> value(\%xmlInput)
            > ;
            >
            > my $response = SOAP::Lite
            > -> readable(1)
            > -> uri($uri)
            > -> proxy($PROXY)
            > -> getDecision($inputSoapParam)
            > ;
            >
            > and here is the catcher's mitt in the server:
            >
            > sub getDecision {
            > my ($obj, $in) = @_;
            > my $out = &do_something(%{$in});
            > }
            >
            > and it works fine for me. I haven't done any performance testing,
            > though, so I am not sure how optimal this is...
            >
            > Thom Eden
            >
            > ---------- Original Message ----------------------------------
            > From: "sharmila_pillai" <sharmila_pillai@...>
            > Date: Fri, 08 Aug 2003 11:13:18 -0000
            >
            > >Hi,
            > >
            > > I am trying to send a hashmap to a soaplite server.
            > >
            > >Client code (snippet) looks like:
            > >
            > >%params = ("program" => "fasta3");
            > >...
            > >my $som = $soap->testhash(SOAP::Data->type(map=>\%params)-
            > >>name('params'));
            > >print $som=>result."\n";
            > >
            > >The soap request looks like:
            > ><namesp1:testhash xmlns:namesp1="TestHash">
            > > <params xsi:type="apachens:Map">
            > > <item>
            > > <key xsi:type="xsd:string">program</key>
            > > <value xsi:type="xsd:string">fasta3</value>
            > > </item>
            > > </params>
            > ></namesp1:testhash>
            > >
            > >The server code snippet:
            > >
            > >my ($self, %params) =@_;
            > >my $value = $params{"program"};
            > >...
            > >
            > >I have gone through the mails here and think the above server code is
            > right. But I
            > >don't seem to be able to access the hash. What am I doing wrong? Is
            > there some
            > >module I am missing?
            > >
            > >Will appreciate any help.
            > >TIA,
            > >Sharmila.
            > >
            > >
            > >
            > >
            > >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/
            > >
            > >
            > >
            >
            > Yahoo! Groups Sponsor
            > ADVERTISEMENT
            > Click Here!
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
            --
            Byrne Reese <byrne@...>
          Your message has been successfully submitted and would be delivered to recipients shortly.