Hi Massimiliano,

Axis2 is just being a bit more strict about schema compliance than Axis1 was
- you have actually indicated in your schema that opDate is required.

Try <element name="opDate" minOccurs="0" type="xsd:dateTime"/>, which
indicates to the parser that the element may or may not appear.  This should
allow the generated code to accept nulls.

--Glen

On 10/1/2010 5:31 AM, Massimiliano Ziccardi wrote:
> Hi All.
> 
> I have the following WSDL (just an extract):
> 
> <element name="op">
>   <complexType>
>   <sequence>
>     <element name="cert" type="xsd:string"/>
>     <element name="reason" type="xsd:int"/>
>     <element name="comment" type="xsd:string"/>
>     <element name="opDate" type="xsd:dateTime"/>
>     </sequence>
>   </complexType>
> </element>
> 
> opDate is optional : the user must be able to pass 'null'.
> 
> I have no problems with axis1, while I can't pass null with AXIS2 because I
> always get 'opDate cannot be null'.
> 
> Looking through the code, I found this inside the generated stub:
> 
> if (localOpDate==null)
> {
> // write the nil attribute                                             
>    throw new org.apache.axis2.databinding.ADBException("opDate cannot be
> null!!");
> }
> else
> {
> xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localOpDate));
> }
> 
> Is there any way I can tell WSDL2JAVA that some parameter is optional?
> If I have to change the wsdl, since it is autogenerated by AXIS2 server side,
> is there a way I can tell AXIS to generate the parameter as optional inside
> the WSDL?
> 
> Thanks a lot,
> Massimiliano
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to