axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service
Date Sat, 12 Mar 2016 23:16:34 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andreas Veithen resolved AXIS2-5301.
------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.8.0

> Axis2 MTOM client outof memory error when downloading file from service
> -----------------------------------------------------------------------
>
>                 Key: AXIS2-5301
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5301
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, databinding
>    Affects Versions: 1.6.1
>         Environment: Windows XP , Axis2 1.6.1, JDK 1.5
>            Reporter: Sridhar Ratna
>             Fix For: 1.8.0
>
>         Attachments: SampleService.zip, SampleServiceClient.zip
>
>
> I am trying to upload and download large binary files with axis2 using MTOM. I am able
to upload upto 2GB file without any memory issue either at server side or client side. But
when downloading file from server to client, client is getting out of memory, though the server
is sending a stream.
> When the response received at client side, javax.activation.Datahandler is embedded in
the response which is a pointer to InputStream. Ideallly it should not give out of memory.
And this is the same mechanism while uploading, and there is no problem at that end.
> Seems to be a bug at client side handling of large documents in response stream.
> WSDL is
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://sample.com/sample/SampleService" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:ax21="http://sample.com/sample/SampleService/xsd" xmlns:ns="http://sample.com/sample/SampleService"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
> <wsdl:documentation>
> 		Please Type your service description here
> 	</wsdl:documentation>
>   <wsdl:types>
>     <xs:schema elementFormDefault="qualified" targetNamespace="http://sample.com/sample/SampleService">
>         	
>        		<xs:complexType name="SampleRequestType">
>        			<xs:sequence>
> 	   				<xs:element maxOccurs="1" minOccurs="1" name="fileName" type="xs:string"/>
> 	   				<xs:element maxOccurs="1" minOccurs="0" name="contentType" type="xs:string"/>
>        			</xs:sequence>
>        		</xs:complexType>
>         	<xs:complexType name="SampleResponseType">
>             	<xs:sequence>
>                 	<xs:element maxOccurs="1" minOccurs="1" name="fileName" type="xs:string"/>
>                     <xs:element maxOccurs="1" minOccurs="0" name="content" type="xs:base64Binary"/>
> 				</xs:sequence>
>             </xs:complexType>
>         	
> 			<xs:element name="SampleRequest" type="ns:SampleRequestType"/>
> 			<xs:element name="SampleResponse" type="ns:SampleResponseType"/>
>         </xs:schema>
>   </wsdl:types>
>   <wsdl:message name="SampleResponse">
>     <wsdl:part name="parameters" element="ns:SampleResponse">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="SampleRequest">
>     <wsdl:part name="parameters" element="ns:SampleRequest">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="SampleServicePortType">
>     <wsdl:operation name="SampleRequest">
>       <wsdl:input message="ns:SampleRequest" wsaw:Action="urn:SampleRequest">
>     </wsdl:input>
>       <wsdl:output message="ns:SampleResponse" wsaw:Action="urn:SampleResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="SampleServiceHttpBinding" type="ns:SampleServicePortType">
>     <http:binding verb="POST"/>
>     <wsdl:operation name="SampleRequest">
>       <http:operation location="SampleRequest"/>
>       <wsdl:input>
>         <mime:content part="parameters" type="text/xml"/>
>       </wsdl:input>
>       <wsdl:output>
>         <mime:content part="parameters" type="text/xml"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="SampleServiceSoap12Binding" type="ns:SampleServicePortType">
>     <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="SampleRequest">
>       <soap12:operation soapAction="urn:SampleRequest" style="document"/>
>       <wsdl:input>
>         <soap12:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap12:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="SampleServiceSoap11Binding" type="ns:SampleServicePortType">
>     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="SampleRequest">
>       <soap:operation soapAction="urn:SampleRequest" style="document"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="SampleService">
>     <wsdl:port name="SampleServiceHttpSoap12Endpoint" binding="ns:SampleServiceSoap12Binding">
>       <soap12:address location="http://localhost:8080/SampleService/services/SampleService.SampleServiceHttpSoap12Endpoint/"/>
>     </wsdl:port>
>     <wsdl:port name="SampleServiceHttpSoap11Endpoint" binding="ns:SampleServiceSoap11Binding">
>       <soap:address location="http://localhost:8080/SampleService/services/SampleService.SampleServiceHttpSoap11Endpoint/"/>
>     </wsdl:port>
>     <wsdl:port name="SampleServiceHttpEndpoint" binding="ns:SampleServiceHttpBinding">
>       <http:address location="http://localhost:8080/SampleService/services/SampleService.SampleServiceHttpEndpoint/"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
> and the service class
> public class SampleService implements SampleServiceSkeletonInterface {
> 	public SampleResponse sampleRequest(SampleRequest req) {
> 		try {
> 			SampleResponse response = new SampleResponse();
> 			SampleResponseType type = new SampleResponseType();
> 			FileInputStream fis = new FileInputStream("c:/tmp/"+req.getSampleRequest().getFileName());
> 			DataHandler dh = new DataHandler(new StreamDataSource(fis, req.getSampleRequest().getContentType()));
> 			type.setContent(dh);
> 			type.setFileName(req.getSampleRequest().getFileName());
> 			response.setSampleResponse(type);
> 			return response;
> 		} catch (FileNotFoundException e) {
> 			e.printStackTrace();
> 		}
> 		
> 		return null;
> 	}
> }
> And the client code
> public static void main(String[] args) throws Exception{
> 		SampleServiceStub stub = new SampleServiceStub();
> 		
> 		stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
> 		//stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_SWA,
Constants.VALUE_TRUE);
> 		stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(1000*60*10 );
> 		
> 		//stub._getServiceClient().getOptions().setProperty(Constants.Configuration.CACHE_ATTACHMENTS,
Constants.VALUE_TRUE);
> 		//stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,
"c:/tmp");
> 		//stub._getServiceClient().getOptions().setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD,
"4000");
> 		SampleRequestType type = new SampleRequestType();
> 		type.setFileName("server.log");
> 		type.setContentType("text/plain");
> 		SampleRequest request = new SampleRequest();
> 		request.setSampleRequest(type);
> 		SampleResponse response = stub.sampleRequest(request);
> 		
> 	}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message