minoccurs=0; nillable="true not interpreted in Web Services

In one of the previous posts I’ve defined a workaround concerning the nillable attribute being ignored when invoking web services using xsd’s defined in the following manner.

Because in bpel you’re not able to define the xsi:nil-attribute at design time, you need to define this manually.

The xsi:nil=true-attribute is the solution to tell web services that this attribute, if empty, needs to be ignored. In this way serialization and deserialization will work, otherwise you will always run into NullPointerException.

What’s the cause of our problem when talking about bpel [metalink Note:403586.1]:
The XSLT transformer used by BPEL was not originally designed to pass xsi:nil attributes.

What’s the proposed solution [metalink Note:403586.1]:
To transfer xsi:nil values from source and target schemas in a transformation, make use of xsl:choose and xsl:when as shown below:

What you could also do is in the web service proxy wizard, which is generated for a given wsdl-document change the serializer-classes. Though this isn’t really the approach you woudl wan’t to consider because now you’re changing generated code, which will be changed when the wizard is run again.

The following important message is shown in your proxy generated classes that urges you to not change the generated code ;o)

// !DO NOT EDIT THIS FILE!// This source file is generated by Oracle tools//
Contents may be subject to change// For reporting problems, use the following//
Version = Oracle WebServices (, build 070610.1800.23513)

What you can do, on your own responsibility, is to change the literal_serializer classes which were generated for each object used in your webservices payload. You need to change the setNullable-method for each attribute from ‘false’ to ‘true’:

if (
matchQName(elementName, ns1_adresId_QNAME) )
myns2_string__java_lang_String_String_Serializer.setNullable( false );

if (
matchQName(elementName, ns1_adresId_QNAME) )
myns2_string__java_lang_String_String_Serializer.setNullable( true);

Another possibility is to create a Service Request and define an Enhancement Request so this manual tweaking isn’t necessary anymore in the future … that’s what I’m doing as well/


3 thoughts on “minoccurs=0; nillable="true not interpreted in Web Services

  1. thanks for blogging this, had the same problem but didn’t want to do masses of choose/when’s in a complex schema, hopefully its fixed in 11g!?

  2. I’ve logged an SR for this, as lots of people did already and filled an enhancement request.Haven’t gotten any feedback on that yet, but hopefully it’s backported instead of fixed in 11g, because a lot of customers are only getting familiar with now ;o)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

About nathalieroman