Passing large file via webservice

8

8

Hi,

I have a webservice project. It requires pass the content of a file
between the services and their clients. The file can be as big as 5M.
We use Oracle 10g application server.

I defined an interface. Use the byte[] to pass the content of a file.
It works for small size files. However, to sending a 1M size of a file,
it took about 10 minutes, and failed with the following exceptions:
Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Server;
msg= [java
..lang.OutOfMemoryError]]
at proxy.
SubmitLargeFileIFProxy.makeSOAPCallRPC(SubmitLargeFileIFProxy.java:102)
at proxy.
SubmitLargeFileIFProxy.submit(SubmitLargeFileIFProxy.java:78)
at SubmitLargeFile.main(SubmitLargeFile.java:44)

I used -Xmx512m in server side, and it ran out of memory.

So I have at least two problems. It took too long even if it handles a
small file. It took too much memory space. I guess it is something to
do with binding. The byte[] is mapped to xsd:base64Binary. I tried
Byte[], it comes with same mapping, and same behavior. I also tried to
hide the byte[] in an object, which implements Serializable. Each time,
the generated wsdl shows the byte[] or Byte[] are mapped to
xsd:base64Binary.

Did I do anything wrong? Is there any better way to send a file via
webservice?

Thanks a lot,

Peter

--------------------------------------------------------------------------------------------
Here is the list of interface.

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface SubmitLargeFileIF extends Remote {
public String submit(String fileName, byte[] fileContent, String
otherInfo) throws RemoteException;
}

Here is the wsdl generated by oracle toolkit
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SubmitLargeFileImpl"
targetNamespace="http://tempuri.org/SubmitLargeFileImpl.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://tempuri.org/SubmitLargeFileImpl.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" >

<documentation>
WSDL for Service: SubmitLargeFileImpl, generated by Oracle WSDL
toolkit (version: 1.1)
</documentation>

<types>
<schema
targetNamespace="http://tempuri.org/SubmitLargeFileImpl.xsd"
xmlns:tns="http://tempuri.org/SubmitLargeFileImpl.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</types>

<message name="submitInput">
<part name="param0" type="xsd:string"/>
<part name="param1" type="xsd:base64Binary"/>
<part name="param2" type="xsd:string"/>
</message>
<message name="submitOutput">
<part name="return" type="xsd:string"/>
</message>

<portType name="SubmitLargeFileImplPortType">
<operation name="submit">
<input message="tns:submitInput"/>
<output message="tns:submitOutput"/>
</operation>
</portType>

<binding name="SubmitLargeFileImplBinding"
type="tns:SubmitLargeFileImplPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
<operation name="submit">
<soap:eek:peration soapAction="urn:SubmitLargeFileImpl/submit"/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:SubmitLargeFileImpl"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:SubmitLargeFileImpl"/>
</output>
</operation>
</binding>

<service name="SubmitLargeFileImpl">
<port name="SubmitLargeFileImplPort"
binding="tns:SubmitLargeFileImplBinding">
<soap:address
location="http://192.168.1.201:80/submitLargeFile/submit"/>
</port>
</service>


</definitions>
 
A

adamspe

Transfering files as byte arrays within SOAP messages is obviously not
going to be scalable, as you're seeing. SOAP with attachments might be
a better way to go, I'm not really sure how scalable it will be though
either. If you're willing to divorce the file transfer from SOAP basic
HTTP PUT/POST would be more efficient avoiding multipart MIME and the
need to examine the incoming streams in search of boundaries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top