views:

246

answers:

0

The Java Bean web call is like this

@WebMethod
    public void updateComment(
      @WebParam(name="Id") int Id,
      @WebParam(name="comment") String comment)
    {
     funct().updateComment(Id, comment);
    }

After binding to the web service in visual studio, the call works fine unless you try to pass a null for the string comment paramater.

Then you get an error, "Cannot find child element: comment".

This seems to be an issue where the parameter is not added to the return call since it was set to null on the client.

How do I allow the web service to take a null argument?

This is a trimmed down version of the WSDL.

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:tns="http://ws.facade.yyyy.xxxx.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PatientService" targetNamespace="http://ws.facade.yyyy.xxxx.com/" xmlns="http://schemas.xmlsoap.org/wsdl/"&gt;
  <types>
    <xs:schema targetNamespace="http://ws.facade.yyyy.xxxx.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;

  <message name="PatientService_updatePatientComment">
    <part name="patientId" type="xsd:int" />
    <part name="comment" type="xsd:string" />
  </message>
  <portType name="PatientService">   
    <operation name="updatePatientComment" parameterOrder="patientId comment">
      <input message="tns:PatientService_updatePatientComment" />
      <output message="tns:PatientService_updatePatientCommentResponse" />
    </operation>
  </portType>
  <binding name="PatientServiceBinding" type="tns:PatientService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />    
    <operation name="updatePatientComment">
      <soap:operation soapAction="" />
      <input>
        <soap:body use="literal" namespace="http://ws.facade.yyyy.xxxx.com/" />
      </input>
      <output>
        <soap:body use="literal" namespace="http://ws.facade.yyyy.xxxx.com/" />
      </output>
    </operation>
  </binding>
  <service name="PatientService">
    <port name="PatientServicePort" binding="tns:PatientServiceBinding">
      <soap:address location="http://xxxxx:8080/yyyy/patient_service" />
    </port>
  </service>
</definitions>