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 "iuser@libero.it" <iu...@libero.it> on 2004/12/14 07:10:16 UTC

Long: Problem with a method that returns byte[]

Hi all,
sorry for the long post but we're facing this problem and any help would be
greatly appreciated.
We have a method with this signature:

byte[] getDocumentDataByteArray(String param1, String param2)

This method, based on param1 and param2, retrieves a document from the server
and returns it to the client with a byte array.

Using JBuilder we'have generated both client and server code with the Axis
Toolkit integrated in this IDE. After making some test with little files
(40/50Kb), we'have tried with bigger files (1/2 Mb). With these files we
experienced a serious performance problem so we decided to see what was
happening "behind the scene" with Ethereal. The sniffing is attached:
------------------ Start request ----------------------

POST /my-services/services/myServices HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost.localdomain
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 706

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getDocumentDataByteArray
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://filenet">
<param1
xsi:type="xsd:string">uWlkqDM045IfYRgD8rouTX4FBw9TILtfzC52Kk27ehQVd4AeqpijKucpJDXlPmnz+RdJjKH2ViJPhMR/XyiAWC+t83jV0vgA25Hwh6oA/YitfBBFTDm0tkmXDD8VOTkmBu2iwHW45IcZXqEhQvnHTPUN77HXkDljuu6vsYAiMUM=</param1>
<param2 xsi:type="xsd:string">003670716</param2>
</ns1:getDocumentDataByteArray>
</soapenv:Body>
</soapenv:Envelope>
------------------ End request ----------------------


------------------ Start response ----------------------

HTTP/1.1 200 OK
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: CVSTag=JBoss_3_2_6
date=200410140106)
Content-Type: text/xml;charset=utf-8
Date: Mon, 13 Dec 2004 14:07:28 GMT
Server: Apache-Coyote/1.1
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getDocumentDataByteArrayResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://myservices">
<ns1:getDocumentDataByteArrayReturn xsi:type="soapenc:Array"
soapenc:arrayType="xsd:byte[1671291]"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item>80</item>
<item>75</item>
<item>3</item>
<item>4</item>
<item>20</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>12</item>
<item>0</item>
<item>54</item>
<item>117</item>
<item>-92</item>
<item>48</item>
<item>-17</item>
<item>100</item>
<item>-57</item>
<item>34</item>
<item>-23</item>
<item>127</item>
<item>25</item>
<item>0</item>
<item>0</item>
<item>-40</item>
.....and so on until the end
------------------ End Response ----------------------

As you can see we think that the big problem is related to the fact that the
byte array of this file of 1,6 Mb is returned using 1,6M element <item>
containing the value of a single byte (16 byte to send 1 byte of payload...).
Why do this happens? We have another method which create a document with this
signature

<return_type> createDocument(String param1, byte[] documentData)

and this document passes the content of the file as an encoded string and not
with all this <item> elements. Why the getDocument method does not use the same
way to send a byte array?

We know that to send large file DIME would be best but we would like to
understand why this happens before investigating DIME......

Thank you in advance
iuser




____________________________________________________________
Libero ADSL: 3 mesi gratis e navighi a 1.2 Mega, senza costi di attivazione.
Abbonati subito su http://www.libero.it