0

Problem:

I have a SOAP service with the following simplified WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://new.webservice.namespace" targetNamespace="http://new.webservice.namespace">
    <wsdl:types>
        <xs:schema targetNamespace="http://new.webservice.namespace" elementFormDefault="qualified"/>
    </wsdl:types>
    <wsdl:message name="NewMessageRequest">
        <wsdl:part name="parameter" type="xs:string"/>
    </wsdl:message>
    <wsdl:message name="NewMessageResponse">
        <wsdl:part name="result" type="xs:string"/>
        <wsdl:part name="param2" type="xs:string"/>
    </wsdl:message>
    <wsdl:portType name="NewPortType">
        <wsdl:operation name="NewOperation">
            <wsdl:input message="tns:NewMessageRequest"/>
            <wsdl:output message="tns:NewMessageResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="NewBinding" type="tns:NewPortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="NewOperation">
            <soap:operation soapAction="urn:#NewOperation"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="NewService">
        <wsdl:port name="NewPort" binding="tns:NewBinding">
            <soap:address location="No Target Adress"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Notice the output message has two parts.

When invoking the SOAP services with SoapUI, the services implemented with the gSOAP framework returns a response which does not comply with the WSDL:

This is the SoapUI request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:new="http://new.webservice.namespace">
   <soapenv:Header/>
   <soapenv:Body>
      <new:NewOperation>
         <parameter>Hello</parameter>
      </new:NewOperation>
   </soapenv:Body>
</soapenv:Envelope>

This is the gSOAP WS response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:new="http://new.webservice.namespace">
   <soapenv:Header/>
   <soapenv:Body>
      <new:NewOperationResponse>
         <result xsi:nil="true"/>
         <param2>Hello World</param2>
      </new:NewOperationResponse>
   </soapenv:Body>
</soapenv:Envelope>

SoapUI complains with the following error:

line5: Element has xsi:nil attribute but is not nillable

Question:

How can I fix the WSDL so the message part is nullable?

Tony Baguette
  • 617
  • 7
  • 14

1 Answers1

0

It appears you may have set the SOAP_XML_NIL flag? This flag should not be set. See the gsoap documentation stating for SOAP_XML_NIL: output NULLs as xsi:nil.

Dr. Alex RE
  • 1,772
  • 1
  • 15
  • 23