One of the issues that I encountered while using Apache Axis was how it would serialize java beans that contained arrays of another custom bean. When a java object is serialized during runtime, the items in the array of the custom bean get marshaled into XML who’s tags do not match that which is defined in the WSDL. For example, the object below gets translated into the following xml…
As you can see, its impossible to determine where the actual items begin in the array. What what we really need is the following so that the XML string conforms to the WSDL where its schema is defined. The
The Axis class responsible for handling this logic is the ArraySerializer class in the org.apache.axis.encoding.ser package. In order to address the problem, the code needs to be changed in this class under the serialize() method. Change the following code by adding the statements that are in bold.
Adding this code tells Axis to create the array element tag name as “item” rather than its actual collection name. the QNAME_LITERAL_ITEM constant is an existing constant that we have leveraged to keep things consistent.
No comments:
Post a Comment