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

Passing complex types

Expand Messages
  • david_ster
    I have a gsoap client and a perl server. I would like to have more than one parameter in output with the soap message. I used a complex type in the header
    Message 1 of 1 , Apr 9 2:58 AM
    View Source
    • 0 Attachment
      I have a gsoap client and a perl server. I would like to have more
      than one parameter in output with the soap message. I used a complex
      type in the header file:
      struct infoFile
      { char *fileName;
      int posini;
      };

      typedef double xsd__double;
      //gsoap ns schema namespace: uri:calc
      int ns__add(int a, int b, char *string,struct infoFile *file);

      In the server I have:
      #!perl -w
      use Data::Dumper;

      use SOAP::Transport::HTTP;

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

      package F_REP;


      sub add(){



      $soap_result=$_[2] +$_[1];



      return SOAP::Data->name('infoFile' => \SOAP::Data->value
      (SOAP::Data-
      >name('fileName' => strings) => SOAP::Data->name('posini' => '123')));

      }

      This produces a soap 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><namesp1:addResponse
      xmlns:namesp1="urn:FA_REP"><infoFile><fileName
      xsi:type="xsd:string">strings</fileName><posini
      xsi:type="xsd:int">123</posini></infoFile></namesp1:addResponse></SOAP
      -ENV:Body></SOAP-ENV:Envelope>

      but when the client tries to read it, I get the error:
      SOAP FAULT: SOAP-ENV:Client
      "Validation constraint violation: tag name or namespace mismatch in
      element <nam
      esp1:addResponse>"

      and in the TEST.log:
      ....
      Receiving SOAP Fault
      Error: soap_get_soapfault() failed. Is this a SOAP message at all?
      Malloc 32 bytes at location 00348D98
      Closing socket 1952
      Malloc 16 bytes at location 00349DD0

      What is wrong with it? any idea of how to do it properly??
      Thanks a lot!!!!
    Your message has been successfully submitted and would be delivered to recipients shortly.