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

gSOAP client and SOAP::Lite server

Expand Messages
  • Monica Vallejo
    Hi I m trying communicate a client writing in C with gSOAP v2.7 to a SOAP::Lite server. I have a very simple function: int ns__test(char *name, char **); I ve
    Message 1 of 2 , Apr 15, 2005
    • 0 Attachment
      Hi

      I'm trying communicate a client writing in C with gSOAP v2.7 to a
      SOAP::Lite server.

      I have a very simple function: int ns__test(char *name, char **);
      I've also added the "-1" option, with no observable effect.It all
      compiles fine, but when I actually run my program, it always ignores
      the s-gensym3 tag that SOAP::Lite returns.

      I've seen some postings in SOAP::Lite's and gSOAP's groups, but i
      haven't found any answer on this issue.

      I've included some debugging information below.

      ======>test.c<========
      #include "soapH.h"

      int main(int argc, char **argv) {
      struct soap soap;

      int q;
      char *user = "xxxxx";

      soap_init(&soap);
      if (soap_call_ns__getUserID(&soap, "http://dev.........", NULL,
      user, &q) == 0)
      printf("----->%d", q);
      else
      soap_print_fault(&soap, stderr);

      return 0;
      }

      struct Namespace namespaces[] =
      {
      {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"}, /*
      MUST be first */
      {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"}, /*
      MUST be second */
      {"xsi", "http://www.w3.org/1999/XMLSchema-instance"}, /*
      MUST be third */
      {"xsd", "http://www.w3.org/1999/XMLSchema"},
      {"ns", "urn:Users"}, /*
      Method namespace URI */
      {NULL, NULL}
      };

      =====>test.h<=======
      //gsoap ns service style: rpc
      //gsoap ns service encoding: encoded
      //gsoap ns service namespace: urn:Users
      //gsoap ns service location: http://dev........
      //gsoap ns service method-action: getUserID ""
      int ns__getUserID(char *user, int *resp);

      =====>soap.cgi<======
      #!/usr/bin/perl -w
      use SOAP::Transport::HTTP;

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

      package Users;


      sub getUserID {
      return 123;
      }

      =====> SENT.log <======
      POST /soap.cgi HTTP/1.1
      Host: dev.........
      User-Agent: gSOAP/2.6
      Content-Type: text/xml; charset=utf-8
      Content-Length: 468
      Connection: close
      SOAPAction: ""

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      xmlns:ns="urn:Users"><SOAP-ENV:Body
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      id="_0"><ns:getUserID><user>xxxxx</user></ns:getUs
      erID></SOAP-ENV:Body></SOAP-ENV:Envelope>


      =====> RECV.log <=======
      HTTP/1.1 200 OK
      Date: Sat, 16 Apr 2005 01:12:03 GMT
      Server: Apache/2.0.52 (Debian GNU/Linux) PHP/4.3.8-12
      mod_perl/1.999.20 Perl/v5.8.4
      SOAPServer: SOAP::Lite/Perl/0.60
      Content-Length: 516
      Connection: close
      Content-Type: text/xml; charset=utf-8

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
      /soap/encoding/"><SOAP-ENV:Body><namesp1:getUserIDResponse
      xmlns:namesp1="urn:Users"><s-gensym3
      xsi:type="xsd:int">1</s-gensym3></namesp1:getUserI
      DResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>


      ==> TEST.log <==
      .....
      End of block sequence, free all remaining blocks
      Tags and (default) namespaces match: 'xsi:type' 'xsi:type'
      Unknown element 's-gensym3' (level=3, 1)
      IGNORING element 's-gensym3'
      End element found (level=3) 's-gensym3'=''
      Popped namespace binding (level=2) 'namesp1'
      .......



      Thanks in advance!
    • Graham Irvine
      Hi Do you have any access to the SOAP::Lite server . Solution to the nuisance being returned by it is to properly escape the SOAP::DATA elements ..
      Message 2 of 2 , Apr 16, 2005
      • 0 Attachment
        Hi

        Do you have any access to the SOAP::Lite server . Solution to the
        <c-gensym> nuisance being returned by it is to properly escape the
        SOAP::DATA elements .. e.g

        => \SOAP::DATA->name('name')->value('value')

        If i was getting a rubbish response from a server using a perl client
        I would deserialize , or parse the raw xml response , by hand as long
        as I had the data in there somewhere , which it appears you do. As
        long as gSOAP gives you that facility the alternative would be to do that.

        HTH
        Graham



        --- In soaplite@yahoogroups.com, "Monica Vallejo" <movallejo@y...> wrote:
        >
        > Hi
        >
        > I'm trying communicate a client writing in C with gSOAP v2.7 to a
        > SOAP::Lite server.
        >
        > I have a very simple function: int ns__test(char *name, char **);
        > I've also added the "-1" option, with no observable effect.It all
        > compiles fine, but when I actually run my program, it always ignores
        > the s-gensym3 tag that SOAP::Lite returns.
        >
        > I've seen some postings in SOAP::Lite's and gSOAP's groups, but i
        > haven't found any answer on this issue.
        >
        > I've included some debugging information below.
        >
        > ======>test.c<========
        > #include "soapH.h"
        >
        > int main(int argc, char **argv) {
        > struct soap soap;
        >
        > int q;
        > char *user = "xxxxx";
        >
        > soap_init(&soap);
        > if (soap_call_ns__getUserID(&soap, "http://dev.........", NULL,
        > user, &q) == 0)
        > printf("----->%d", q);
        > else
        > soap_print_fault(&soap, stderr);
        >
        > return 0;
        > }
        >
        > struct Namespace namespaces[] =
        > {
        > {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"}, /*
        > MUST be first */
        > {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"}, /*
        > MUST be second */
        > {"xsi", "http://www.w3.org/1999/XMLSchema-instance"}, /*
        > MUST be third */
        > {"xsd", "http://www.w3.org/1999/XMLSchema"},
        > {"ns", "urn:Users"}, /*
        > Method namespace URI */
        > {NULL, NULL}
        > };
        >
        > =====>test.h<=======
        > //gsoap ns service style: rpc
        > //gsoap ns service encoding: encoded
        > //gsoap ns service namespace: urn:Users
        > //gsoap ns service location: http://dev........
        > //gsoap ns service method-action: getUserID ""
        > int ns__getUserID(char *user, int *resp);
        >
        > =====>soap.cgi<======
        > #!/usr/bin/perl -w
        > use SOAP::Transport::HTTP;
        >
        > SOAP::Transport::HTTP::CGI
        > -> dispatch_to('Users')
        > -> handle;
        >
        > package Users;
        >
        >
        > sub getUserID {
        > return 123;
        > }
        >
        > =====> SENT.log <======
        > POST /soap.cgi HTTP/1.1
        > Host: dev.........
        > User-Agent: gSOAP/2.6
        > Content-Type: text/xml; charset=utf-8
        > Content-Length: 468
        > Connection: close
        > SOAPAction: ""
        >
        > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        > xmlns:ns="urn:Users"><SOAP-ENV:Body
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > id="_0"><ns:getUserID><user>xxxxx</user></ns:getUs
        > erID></SOAP-ENV:Body></SOAP-ENV:Envelope>
        >
        >
        > =====> RECV.log <=======
        > HTTP/1.1 200 OK
        > Date: Sat, 16 Apr 2005 01:12:03 GMT
        > Server: Apache/2.0.52 (Debian GNU/Linux) PHP/4.3.8-12
        > mod_perl/1.999.20 Perl/v5.8.4
        > SOAPServer: SOAP::Lite/Perl/0.60
        > Content-Length: 516
        > Connection: close
        > Content-Type: text/xml; charset=utf-8
        >
        > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
        > /soap/encoding/"><SOAP-ENV:Body><namesp1:getUserIDResponse
        > xmlns:namesp1="urn:Users"><s-gensym3
        > xsi:type="xsd:int">1</s-gensym3></namesp1:getUserI
        > DResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
        >
        >
        > ==> TEST.log <==
        > .....
        > End of block sequence, free all remaining blocks
        > Tags and (default) namespaces match: 'xsi:type' 'xsi:type'
        > Unknown element 's-gensym3' (level=3, 1)
        > IGNORING element 's-gensym3'
        > End element found (level=3) 's-gensym3'=''
        > Popped namespace binding (level=2) 'namesp1'
        > .......
        >
        >
        >
        > Thanks in advance!
      Your message has been successfully submitted and would be delivered to recipients shortly.