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">
<soapperation 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>
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">
<soapperation 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>