You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Sridhar Ratna (JIRA)" <ji...@apache.org> on 2012/04/25 16:18:19 UTC

[jira] [Created] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Sridhar Ratna created AXIS2-5301:
------------------------------------

             Summary: 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


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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264282#comment-13264282 ] 

Andreas Veithen commented on AXIS2-5301:
----------------------------------------

Yes, if SwA and MTOM are both enabled, then SwA takes precedence (because it defines a different message model, and not just an optimization of the SOAP model). This means that MTOM-style attachments will be inlined.

Note that the OOM error reveals another issue, namely that Axis2 attempts to read the entire SOAP part into memory before starting to process it. This is described in AXIS2-5302. With a fix for that issue applied, the OOM error would be slightly different:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at com.ctc.wstx.util.TextBuffer.finishCurrentSegment(TextBuffer.java:1146)
	at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4749)
	at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4113)
	at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3688)
	at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3644)
	at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:851)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:287)
	at org.apache.axiom.om.impl.llom.SwitchingWrapper.writeTextTo(SwitchingWrapper.java:419)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:237)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponseType$Factory.parse(SampleServiceStub.java:749)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponse$Factory.parse(SampleServiceStub.java:2002)
	at com.sample.sample.sampleservice.SampleServiceStub.fromOM(SampleServiceStub.java:2109)
	at com.sample.sample.sampleservice.SampleServiceStub.sampleRequest(SampleServiceStub.java:193)
	at com.sample.sampleservice.client.Client.main(Client.java:45)

With that stack trace it is clear that the OOM error occurs while reading base64Binary data from the SOAP part.
                
> 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
>              Labels: file_download_service, large_file_download, stream_copy_exception, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261862#comment-13261862 ] 

Sridhar Ratna commented on AXIS2-5301:
--------------------------------------

Sure. I'll test and update
                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261911#comment-13261911 ] 

Sridhar Ratna commented on AXIS2-5301:
--------------------------------------

Tested with axis2 1.6.2 and still getting the same error.
Stack trace is 
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisOperation).
log4j:WARN Please initialize the log4j system properly.
java.lang.OutOfMemoryError: Java heap space
	at java.lang.String.<init>(String.java:208)
	at java.lang.StringBuffer.toString(StringBuffer.java:586)
	at org.apache.commons.httpclient.Wire.wire(Wire.java:84)
	at org.apache.commons.httpclient.Wire.input(Wire.java:122)
	at org.apache.commons.httpclient.WireLogInputStream.read(WireLogInputStream.java:71)
	at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:182)
	at java.io.FilterInputStream.read(FilterInputStream.java:111)
	at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
	at java.io.FilterInputStream.read(FilterInputStream.java:111)
	at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer(MimeBoundaryInputStream.java:223)
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.read(MimeBoundaryInputStream.java:157)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.read(BufferedLineReaderInputStream.java:158)
	at org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read(LineReaderInputStreamAdaptor.java:67)
	at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
	at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:119)
	at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176)
	at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149)
	at org.apache.axiom.attachments.PartImpl.getInputStream(PartImpl.java:224)
	at org.apache.axiom.attachments.PartDataSource.getInputStream(PartDataSource.java:44)
	at javax.activation.DataHandler.getInputStream(DataHandler.java:237)
	at org.apache.axiom.attachments.MIMEMessage.getRootPartInputStream(MIMEMessage.java:196)
	at org.apache.axiom.attachments.Attachments.getRootPartInputStream(Attachments.java:248)
	at org.apache.axiom.attachments.Attachments.getSOAPPartInputStream(Attachments.java:224)
	at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:78)
	at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)

                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Issue Comment Edited] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264282#comment-13264282 ] 

Andreas Veithen edited comment on AXIS2-5301 at 4/28/12 11:16 AM:
------------------------------------------------------------------

Yes, if SwA and MTOM are both enabled, then SwA takes precedence (because it defines a different message model, and not just an optimization of the SOAP model). This means that MTOM-style attachments will be inlined.

Note that the OOM error reveals another issue, namely that Axis2 attempts to read the entire SOAP part into memory before starting to process it. This is described in AXIS2-5302. With a fix for that issue applied, the OOM error would be slightly different:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at com.ctc.wstx.util.TextBuffer.finishCurrentSegment(TextBuffer.java:1146)
	at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4749)
	at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4113)
	at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3688)
	at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3644)
	at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:851)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:287)
	at org.apache.axiom.om.impl.llom.SwitchingWrapper.writeTextTo(SwitchingWrapper.java:419)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:237)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponseType$Factory.parse(SampleServiceStub.java:749)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponse$Factory.parse(SampleServiceStub.java:2002)
	at com.sample.sample.sampleservice.SampleServiceStub.fromOM(SampleServiceStub.java:2109)
	at com.sample.sample.sampleservice.SampleServiceStub.sampleRequest(SampleServiceStub.java:193)
	at com.sample.sampleservice.client.Client.main(Client.java:45)

With that stack trace it is clear that the OOM error occurs while reading base64Binary data from the SOAP part. Interestingly that stack trace also reveals another issue (or better opportunity for improvement), namely AXIOM-417.
                
      was (Author: veithen):
    Yes, if SwA and MTOM are both enabled, then SwA takes precedence (because it defines a different message model, and not just an optimization of the SOAP model). This means that MTOM-style attachments will be inlined.

Note that the OOM error reveals another issue, namely that Axis2 attempts to read the entire SOAP part into memory before starting to process it. This is described in AXIS2-5302. With a fix for that issue applied, the OOM error would be slightly different:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at com.ctc.wstx.util.TextBuffer.finishCurrentSegment(TextBuffer.java:1146)
	at com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.java:4749)
	at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4113)
	at com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:3688)
	at com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java:3644)
	at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:851)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getText(XMLStreamReaderWrapper.java:164)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:287)
	at org.apache.axiom.om.impl.llom.SwitchingWrapper.writeTextTo(SwitchingWrapper.java:419)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:237)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponseType$Factory.parse(SampleServiceStub.java:749)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponse$Factory.parse(SampleServiceStub.java:2002)
	at com.sample.sample.sampleservice.SampleServiceStub.fromOM(SampleServiceStub.java:2109)
	at com.sample.sample.sampleservice.SampleServiceStub.sampleRequest(SampleServiceStub.java:193)
	at com.sample.sampleservice.client.Client.main(Client.java:45)

With that stack trace it is clear that the OOM error occurs while reading base64Binary data from the SOAP part.
                  
> 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
>              Labels: file_download_service, large_file_download, stream_copy_exception, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261942#comment-13261942 ] 

Sridhar Ratna commented on AXIS2-5301:
--------------------------------------

looked at the source code of org.apache.commons.httpclient.Wire.wire and found that at line 84 there is a debud  line
log.debug(buffer.toString()); 

which is causing out of memory. then i changed the log level into info and got the following stacktrace
java.lang.OutOfMemoryError: Java heap space
	at org.apache.axiom.attachments.utils.BAAOutputStream.addBuffer(BAAOutputStream.java:49)
	at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:120)
	at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:119)
	at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176)
	at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149)
	at org.apache.axiom.attachments.PartImpl.getInputStream(PartImpl.java:224)
	at org.apache.axiom.attachments.PartDataSource.getInputStream(PartDataSource.java:44)
	at javax.activation.DataHandler.getInputStream(DataHandler.java:237)
	at org.apache.axiom.attachments.MIMEMessage.getRootPartInputStream(MIMEMessage.java:196)
	at org.apache.axiom.attachments.Attachments.getRootPartInputStream(Attachments.java:248)
	at org.apache.axiom.attachments.Attachments.getSOAPPartInputStream(Attachments.java:224)
	at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:78)
	at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
	at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
	at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
	at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
	at com.sample.sampleservice.client.Client.main(Client.java:51)


                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262721#comment-13262721 ] 

Sridhar Ratna commented on AXIS2-5301:
--------------------------------------

Changed the axis2.xml and set the below property to false (earlier it was true)
<parameter name="enableSwA">false</parameter>

In client response returned propery. But when tried to read the data with the below
InputStream in = response.getSampleResponse().getContent().getInputStream();

got the following exceptionm
org.apache.axiom.om.OMException: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:153)
	at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176)
	at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149)
	at org.apache.axiom.attachments.PartImpl.getDataSource(PartImpl.java:234)
	at org.apache.axiom.attachments.PartDataHandler.getDataSource(PartDataHandler.java:50)
	at com.sample.sampleservice.client.Client.main(Client.java:118)
Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
	at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
	at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:107)
	at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:125)
	... 5 more
Caused by: java.io.IOException: Attempted read on closed stream.
	at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)
	at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
	at java.io.FilterInputStream.read(FilterInputStream.java:111)
	at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer(MimeBoundaryInputStream.java:223)
	at org.apache.james.mime4j.io.MimeBoundaryInputStream.read(MimeBoundaryInputStream.java:157)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
	at org.apache.james.mime4j.io.BufferedLineReaderInputStream.read(BufferedLineReaderInputStream.java:158)
	at org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read(LineReaderInputStreamAdaptor.java:67)
	at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
	... 7 more

                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262627#comment-13262627 ] 

Sridhar Ratna commented on AXIS2-5301:
--------------------------------------

I got the same error while working with axis2 1.6.1 and axis2 1.6.2. This stack is generated from Axiom 1.2.12.

Given a look at the BAAOutputStream.java and it is storing the 4K size of buffers to arraylist which is causing the problem.
the following is get called repeated ly.

    private void addBuffer() {
        currBuffer = new byte[BUFFER_SIZE];
        data.add(currBuffer);
        index = 0;
    }

I didn't understand when the Inputstream is available why populating into Byte[]
                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264337#comment-13264337 ] 

Andreas Veithen commented on AXIS2-5301:
----------------------------------------

With AXIOM-417 implemented, the OOM error would now be:

java.lang.OutOfMemoryError: Java heap space
	at org.apache.axiom.util.blob.MemoryBlob.addBuffer(MemoryBlob.java:160)
	at org.apache.axiom.util.blob.MemoryBlob$OutputStreamImpl.write(MemoryBlob.java:51)
	at org.apache.axiom.util.base64.Base64DecodingOutputStreamWriter.doWrite(Base64DecodingOutputStreamWriter.java:37)
	at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.decode(AbstractBase64DecodingWriter.java:100)
	at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.write(AbstractBase64DecodingWriter.java:57)
	at org.apache.axiom.util.base64.AbstractBase64DecodingWriter.write(AbstractBase64DecodingWriter.java:39)
	at com.ctc.wstx.sr.BasicStreamReader.readAndWriteText(BasicStreamReader.java:5024)
	at com.ctc.wstx.sr.BasicStreamReader.getText(BasicStreamReader.java:1355)
	at org.apache.axiom.util.stax.dialect.Woodstox4StreamReaderWrapper.writeTextTo(Woodstox4StreamReaderWrapper.java:135)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
	at org.apache.axiom.om.impl.llom.SwitchingWrapper.writeTextTo(SwitchingWrapper.java:419)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.writeTextTo(XMLStreamReaderUtils.java:285)
	at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:237)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponseType$Factory.parse(SampleServiceStub.java:749)
	at com.sample.sample.sampleservice.SampleServiceStub$SampleResponse$Factory.parse(SampleServiceStub.java:2002)
	at com.sample.sample.sampleservice.SampleServiceStub.fromOM(SampleServiceStub.java:2109)
	at com.sample.sample.sampleservice.SampleServiceStub.sampleRequest(SampleServiceStub.java:193)
	at com.sample.sampleservice.client.Client.main(Client.java:46)

This is what is expected in this case (where the decoded base64 data doesn't fit into memory).
                
> 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
>              Labels: file_download_service, large_file_download, stream_copy_exception, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Updated] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sridhar Ratna (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sridhar Ratna updated AXIS2-5301:
---------------------------------

    Attachment: SampleServiceClient.zip
                SampleService.zip

Service eclipse project
Service client eclipse project
                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262163#comment-13262163 ] 

Andreas Veithen commented on AXIS2-5301:
----------------------------------------

What is interesting here is that the OOM error already occurs while processing the SOAP part of the message and not while accessing the attachment part (as one would expect). What is the stack trace that you get with Axis2 1.6.1 and Axiom 1.2.12?
                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (AXIS2-5301) Axis2 MTOM client outof memory error when downloading file from service

Posted by "Sagara Gunathunga (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13261743#comment-13261743 ] 

Sagara Gunathunga  commented on AXIS2-5301:
-------------------------------------------

Can you test with latest 1.6.2 also ? 
                
> 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
>              Labels: file_download_service, large_file_download, webservice_download_client
>         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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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