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

SOAP::Lite <--> gsoap hazzle...

Expand Messages
  • andremerzky
    Hi folx, I have a service running in SOAP::Lite, and want to connect with a gsoap client. Seems all works fine, BUT arrays are making problems. Below is some
    Message 1 of 1 , May 23, 2005
      Hi folx,

      I have a service running in SOAP::Lite, and want to connect with a
      gsoap client. Seems all works fine, BUT arrays are making problems.

      Below is some code snippet from the service, and the resulting xml

      # server.pl
      my $dispatch = {'GridPerls_TestService' => "GridPerls::TestService"};
      my %flags = ('LocalPort' => '1234',
      'Reuse' => '1');
      my $server = new SOAP::Transport::HTTP::Daemon (%flags)
      -> dispatch_with ($dispatch)
      -> handle ();

      # GridPerls/TestService.pm
      sub list ()
      my @entries = ();
      push (@entries, {'name' => "name 1", 'type' => 1});
      push (@entries, {'name' => "name 2", 'type' => 2});

      my $ret = SOAP::Data -> name ('ListResponse')
      -> value (\@entries);
      # print Dumper (\$ret);
      return ($ret);
      XML message:
      HTTP/1.1 200 OK
      Date: Mon, 23 May 2005 07:33:49 GMT
      Server: libwww-perl-daemon/1.36
      Content-Length: 740
      Content-Type: text/xml; charset=utf-8
      SOAPServer: SOAP::Lite/Perl/0.60

      <?xml version="1.0" encoding="UTF-8"?>
      <namesp1:ListResponse xmlns:namesp1="GridPerls_TestService">
      <ListResponse xsi:type="SOAP-ENC:Array"
      <item><name xsi:type="xsd:string">name 1</name>
      <type xsi:type="xsd:int">1</type></item>
      <item><name xsi:type="xsd:string">name 2</name>
      <type xsi:type="xsd:int">2</type></item>

      The XML message looks pretty good, but gsoap does not like
      <ListResponse xsi:type="SOAP-ENC:Array"
      If I change that manually to <ListResponse>, the client is parsing
      the array fine.

      The header definition I use to defin the gsoap interface is:
      struct GPTest__ListHashEntry {
      xsd__string name;
      xsd__int type;

      struct GPTest__ListHash {
      struct GPTest__ListHashEntry * __ptr;
      xsd__int __size;

      int GPTest__List (xsd__string path,
      struct GPTest__ListHash * ListResponse);

      The WSDL generated from it looks like (excerpt):
      <complexType name="ListHashEntry">
      <element name="name" type="xsd:string" minOccurs="0"
      maxOccurs="1" nillable="true"/>
      <element name="type" type="xsd:int" minOccurs="1"
      <complexType name="ListHash">
      <element name="item" type="GPTest:ListHashEntry" minOccurs="0"
      maxOccurs="unbounded" nillable="true"/>

      <message name="ListRequest">
      <part name="path" type="xsd:string"/>

      <message name="ListResponse">
      <part name="ListResponse" type="GPTest:ListHash"/>

      <portType name="GridPerls_TestServicePortType">
      <operation name="List">
      <input message="tns:ListRequest"/>
      <output message="tns:ListResponse"/>

      I would like to know:
      - is SOAP::Lite or gsoap behaving badly?
      - either way: how can I supress the SOAP-ENC:Array markers in gsoap?
      - does anybody on this list know gsoap well enough to understand why
      it does not like the array markers?

      BTW: the same problem comes the way around: I cant convince gsoap to
      send an array in a format that SOAP::Lite likes...

      To motivate an answer ;) : once I have that running, I certainly will
      post a detailed description on how to get SOAP::Lite and gsoap to
      cooperate. I have SOAP::Lite running in modperl with GSI security
      mod_gridsite.so, and it works like a charm. The Array thing is the
      last (but crucial) piece I have to solve...

      Cheers, and thanks for your time,

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