Sorry if this is obvious, but is there a way to make a method argument optional from an exported interface?

public interface MyInterface {
    @WebMethod(operationName="optionalTest")
public String optionalTest(@WebParam(name="required") String required,
        @WebParam(name="optional") String optional);
}

If a client sends this, it works:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ " xmlns:csm="http://www.test.com/service";>
   <soapenv:Header/>
   <soapenv:Body>
      <csm:optionalTest>
         <csm:required>Value1</csm:required>
         <csm:optional></csm:optional>
      </csm:optionalTest>
   </soapenv:Body>
</soapenv:Envelope>

But if they send this (which I want / need to allow for various reasons), I get a fault: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ " xmlns:csm="http://www.test.com/service";>
   <soapenv:Header/>
   <soapenv:Body>
      <csm:optionalTest>
         <csm:required>Value1</csm:required>
      </csm:optionalTest>
   </soapenv:Body>
</soapenv:Envelope>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance ">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
<faultstring>Not enough message parts were received for the operation.</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Reply via email to