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/

Integrating Flex and Data Management Services with a Bpel process – What about Typed Collections?

As you can remember we’re working out a flex application using Data Management Services and Flex for the client-side and Bpel at server side.

During development I ran into a blocking issue regarding using typed collections in my ActionScript objects.

Why would I use Typed Arguments, Typed Collections or Typed Arrays ?
My bpel process is using a Global Business Object (GBO), an XML Schema Definition, that defines the entire structure of the business objects I will need in the dossier management lifecycle. The bpel process will be cut pu into different sub processes which will define the needed process lifecycle for the dossier management system we’re building.

Of course this kind of business functionality will be handling master-detail data, e.g. a dossier has dossier_members and dossier_members have address_information.

If we create a web service proxy client for our bpel process, the different objects used in this process will be defined as Java Objects. The hierarchical structure of the dossier-element or – object will be defined in the following manner:

public class Dossier implements java.io.Serializable {
protected int id;
protected be.ws.proxy.types.DossierMembersCollection dosMembersCollection;

public class DossierMembersCollection implements java.io.Serializable
protected be.kg.ws.proxy.types.DossierMembers[] dossierMember;

The ActionScript Objects I defined for these server side objects :

class Dossier
public var id:int;
public var dosMembersCollection:DossierMembersCollection;

public class DossierMembersCollection
public var dossierMembers:ArrayCollection;

The exception I run into :

ArgumentError: Error #2004: One of the parameters is invalid. at

What does this mean?
In order for this to work, you need to serialize, you’d need to override both the readExternal and writeExternal methods on both the client and server to take of the serialization of the typed collections yourself.

Practical Approach:

  • Implement the Externalizable Interface at Client- and Server-side
  • Overwrite the readExternal()- and writeExternal()-method in both your client and server classes which match (i.e. the read methods exactly match the write methods on both client and server). You need to serialize your fields as well as the source field of the ArrayCollection (it is an Array).

Take care of serialization and deserialization at server-side, use Externalizable Interface:

public class DossierMembersCollection implements java.io.Serializable ,
Externalizable { protected be.kg.ws.proxy.types.DossierMembers[] dossierMembers;

public DossierMembersCollection() { }

/*** Deserializes the client state of an instance of dossierMembers. */ public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
System.out.println(“Receiving array ———————–”);
Object[] obj2 = (Object[]) in.readObject();
System.out.println(“Read input array obj2 ———————–”);

if (obj2 != null) {
DossierMembers[] dossierMembers = new DossierMembers[obj2.length];
System.out.println(“Initialized dossierMembers———————–”);
loop over the object array and cast the Object-classes to your custom class.
System.out.println(“Looping over array ———————–”); dossierMembers[i] = (DossierMembers) obj2[i];

System.out.println(“DossierMembers: ” + dossierMembers[i].toString());

System.out.println(“Receiving array DONE ————————”); }

/*** Serializes the server state of an instance of dossierMembers. */

public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(dossierMembers); }

Take care of serialization and deserialization at client-side:


[RemoteClass alias="be.kg.ws.proxy.types.DossierMembersCollection")]

public class DossierMembersCollection implements IExternalizable {

public var dossierMembers:ArrayCollection;

public function readExternal(input:IDataInput):void {
trace(“***********Reading dossierMembers”);
var array:Array = input.readObject() as Array;
if (array!=null) {
trace(“****Array received”);
dossierMembers = new ArrayCollection();
Loop over the array and add the arrayElements as typed objects to your collection in the following way:

dossierMembers.addItem(array.pop() as DossierMembers);

trace(“**Number of dossierMembers : ” + dossierMembers.length); }

public function writeExternal(output:IDataOutput):void {

trace(“Write ArrayCollection dossierMembers to array”);

var array:Array = new Array();

loop over object-array and add array-items to the collection: {


trace(dossierMembers.getItemAt(i).toString()); }

output.writeObject(array); trace(“Done”); } }

If you get random errors there will propbably be a mismatch between server- and client-side objects. The two approaches you can use are: print statements or stopping in your read/write external methods in the debugger. Step through actionscript classes and Java classes using Flex Debugging mode, so you can ensure that you are reading exactly what you are writing.

Hopefully this will help a lot of people facing the same issues regarding typed objects in an Adobe Flex Environment.