Slow performance when using byte arrays
 Technote (troubleshooting)
 
Problem(Abstract)
Sending byte arrays through Web Services may perform extremely poorly if older versions of the WebSphere® Application Server Java2WSDL tool are used.
 
Cause
This problem arises specifically in the Java2WSDL tooling that is found in versions before 5.0.2.7 and 5.1.1.1. WebSphere Studio Application Server also relies on the Java2WSDL tooling to generate the Web services files.
Imagine a Java™Bean with the following function header:

public String sayHello(byte[] file)

The JAX-RPC specification allows a Java byte array (byte[]) to be mapped to two XSD datatypes.

1) The first is the xsd:base64Binary datatype. For example, the WSDL may have the following to correspond to the above method declaration:

<complexType name="ComplexType1">
<sequence>
<element name="correct" type="xsd:base64Binary"/>
</sequence>
</complexType>

<element name="sayHello" type="impl:ComplexType1"/>

In this case, the byte[] is converted using Base64 encoding. The HTTP trace would have the following data in the SOAP message. AQID is the base64 representation of 123.

<sayHello xmlns="http://myPackage">
<correct>AQID</correct>
</sayHello>

2) The second is an array of xsd:byte. For example, the WSDL may have the following to correspond to the above method declaration:

<complexType name="ComplexType1">
<sequence>
<element maxOccurs="unbounded" name="incorrect" type="xsd:byte"/>
</sequence>
</complexType>

<element name="sayHello" type="impl:ComplexType1"/>

The TCP trace would have the following corresponding to above for a byte[] = {1,2,3}::

<sayHello xmlns="http://myPackage">
<incorrect>1</incorrect>
<incorrect>2</incorrect>
<incorrect>3</incorrect>
</sayHello>

In this second case, an element is created for EVERY byte in the array. So, if a 5KB byte array is used to send a file, then 5000 incorrect elements will be created. This can lead to very slow server and client performance because so many elements have to be parsed.
 
Resolving the problem
In the WebSphere Application Server Java2WSDL tool found in versions before 5.0.2.7 and 5.1.1.1, byte[] maps into an element with xsd:byte and maxOccurs="unbounded." Download the latest fixes so that the tooling maps byte[] to xsd:base64Binary.
This fix is found in PQ87148 which can be accessed through the following URL
WebSphere Application Server__APAR_/swg1PQ87148.html
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers WebSphere Application Server for z/OS Not Applicable
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Web Services (for example: SOAP or UDDI or WSGW or WSIF)
Operating system(s): z/OS
Software version: 5.1.1
Software edition:
Reference #: 1215874
IBM Group: Software Group
Modified date: Jul 28, 2006