You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Kasi, Anand" <An...@sabre-holdings.com> on 2005/12/05 00:35:31 UTC

java.io.IOException: Non nillable element is null

Hi,

I have an issue here which is happening only in Axis 1.3 and not 1.1. I
am getting the following exception. 

17:20:14,196 ERROR [BeanSerializer] Exception:
java.io.IOException: Non nillable element 'usernameToken' is null.
	at
org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.jav
a:215)
	at
org.apache.axis.encoding.SerializationContext.serializeActual(Serializat
ionContext.java:1502)
	at
org.apache.axis.encoding.SerializationContext.serialize(SerializationCon
text.java:978)
	at
org.apache.axis.encoding.SerializationContext.serialize(SerializationCon
text.java:799)
	at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)
	at
org.apache.axis.message.RPCHeaderParam.outputImpl(RPCHeaderParam.java:45
)
	at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
	at
org.apache.axis.message.SOAPHeader.outputImpl(SOAPHeader.java:328)
	at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:476)
	at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
	at org.apache.axis.client.Call.invoke(Call.java:2757)
	at org.apache.axis.client.Call.invoke(Call.java:2443)
	at org.apache.axis.client.Call.invoke(Call.java:2366)
	at org.apache.axis.client.Call.invoke(Call.java:1812)


I have pasted the code fragment from the corresponding stub file auto
generated by Axis from the wsdl. 
         typeDesc.setXmlType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/12/secext"
, ">>Security>UsernameToken"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("username");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/12/secext"
, "Username"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);

I tried changing nillable to true, but still have the same problem. Axis
seems to not handle minOccurs and nillable well. I am confused as to
what I can try here? This was not an issue with Axis 1.1

Please help. 

Anand




RE: java.io.IOException: Non nillable element is null

Posted by Jerry DuVal <jd...@pace2020.com>.
When the element is nillable="false" then you are not able to set the value
to null. If you set nillable="true" then regenerate the stubs you should not
get this error, but with the minOccurs="0" and nillable="true" when you set
the value to null it will not send the placeholder.  

 

Jerry DuVal
Pace Systems Group, Inc.
800.624.5999
www.Pace2020.com 

  _____  

From: Kasi, Anand [mailto:Anand.Kasi@sabre-holdings.com] 
Sent: Sunday, December 04, 2005 6:36 PM
To: axis-user@ws.apache.org
Subject: java.io.IOException: Non nillable element is null

 

Hi,

I have an issue here which is happening only in Axis 1.3 and not 1.1. I am
getting the following exception. 

17:20:14,196 ERROR [BeanSerializer] Exception:

java.io.IOException: Non nillable element 'usernameToken' is null.

        at
org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:21
5)

        at
org.apache.axis.encoding.SerializationContext.serializeActual(SerializationC
ontext.java:1502)

        at
org.apache.axis.encoding.SerializationContext.serialize(SerializationContext
.java:978)

        at
org.apache.axis.encoding.SerializationContext.serialize(SerializationContext
.java:799)

        at org.apache.axis.message.RPCParam.serialize(RPCParam.java:208)

        at
org.apache.axis.message.RPCHeaderParam.outputImpl(RPCHeaderParam.java:45)

        at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)

        at
org.apache.axis.message.SOAPHeader.outputImpl(SOAPHeader.java:328)

        at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:476)

        at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)

        at org.apache.axis.client.Call.invoke(Call.java:2757)

        at org.apache.axis.client.Call.invoke(Call.java:2443)

        at org.apache.axis.client.Call.invoke(Call.java:2366)

        at org.apache.axis.client.Call.invoke(Call.java:1812)

 

I have pasted the code fragment from the corresponding stub file auto
generated by Axis from the wsdl. 

         typeDesc.setXmlType(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/12/secext",
">>Security>UsernameToken"));

        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();

        elemField.setFieldName("username");

        elemField.setXmlName(new
javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2002/12/secext",
"Username"));

        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));

        elemField.setMinOccurs(0);

        elemField.setNillable(false);

        typeDesc.addFieldDesc(elemField);

I tried changing nillable to true, but still have the same problem. Axis
seems to not handle minOccurs and nillable well. I am confused as to what I
can try here? This was not an issue with Axis 1.1

Please help. 

 

Anand