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

5366Suppressing xsi:nil for methods with no parameters

Expand Messages
  • balajisrinivasan00
    Apr 17, 2006
    • 0 Attachment
      Hi Everyone
      I am trying to get a SOAP::Lite client working with a GSOAP web
      service. I want to enable strict parsing on the GSOAP side so that I
      can catch errors before the request reaches my code.

      For web service methods that take in no parameters, SOAP::Lite encodes
      a xsi:nil="true" attribute in the soap body. For example if the
      request is doStuff, the XML looks as follows:

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      <namesp38:doStuff xsi:nil="true" xmlns:namesp38="http://foo.com/bar/"/>

      Now this causes GSOAP to error out saying xsi:nil is not allowed. I
      believe GSOAP is doing the right thing. The method name (here doStuff)
      cannot be nil. So SOAP::Lite should not be setting its xsi:nil
      attribute. The error is in the envelope method:
      The value of body should be set only if parameters is defined. So we
      need to change the code in line 1402 from:
      $body->set_value(SOAP::Utils::encode_data($parameters ?
      \$parameters : ()))
      if $body;


      $body->set_value(SOAP::Utils::encode_data($parameters ?
      \$parameters : ()))
      if $body && $parameters;

      Can anyone comment on this fix?