Sure, use the sample MTOMSwASampleService, and the sample # 51 configuration and transfer a huge file using MTOM.. You will need to enable caching for MTOM on the axis2.xml as
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments" locked="false">true</parameter>
<parameter name="attachmentDIR" locked="false">/tmp</parameter>
<parameter name="sizeThreshold" locked="false">4000</parameter>
Just now I transferred a file of 123MB just fine..
[java] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
[java] at java.util.Arrays.copyOf(Arrays.java:2786)
[java] at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:133)
[java] at com.sun.mail.util.ASCIIUtility.getBytes(ASCIIUtility.java:248)
[java] at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:175)
[java] at org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
[java] at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
[java] at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
[java] at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
[java] at org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder.getDataHandler(MTOMStAXSOAPModelBuilder.j
ava:104)
[java] at org.apache.axiom.om.impl.llom.OMTextImpl.getDataHandler(OMTextImpl.java:324)
[java] at samples.userguide.MTOMSwAClient.sendUsingMTOM(Unknown Source)
[java] at samples.userguide.MTOMSwAClient.main(Unknown Source)
[java] Java Result: 1
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">/tmp</parameter>
<parameter name="sizeThreshold">4000</parameter>
Please if I'm wrong explain my all the steps.
I have 2 java virtual machines ( The server and the ESB) This not change.
But when execute ant in the client appear 2 java virtual machines more, 1 of this cause the exception. Then, Is fault of the client?
Yes, this is definitely a client side problem (confirmed by your stack trace..) However, when I tried the example transfer, my client ran just fine.. and without changing the client's axis2.xml - i.e. I only changed the ESB's axis2.xml to enable MTOM caching
Again, I can confirm that the sample 51 runs as expected without any issues - using a fresh ESB 1.6 release installation
I can transfer a file of ~123MB when I uncomment the following from the ESB axis2.xml
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments" locked="false">true</parameter>
<parameter name="attachmentDIR" locked="false">/tmp</parameter>
<parameter name="sizeThreshold" locked="false">4000</parameter>
and the file transfers back and forth and diff shows me that the results are correct.
My laptop is a dual core 2GB ram system, and I use JDK 1.5.0_13. New JDK's correctly 'guess' server class systems, and adjust heap memory etc, looking at whats available. But on a low end desktop environment, unless you specify the Java "-Xms" and "-Xmx" parameters for the heap size, it could start from as little as 16MB
I am not experienced to comment on the memory use for MTOM by axis2 clients, but you could try increasing the heap for your client say "-Xms128m -Xmx256M" when starting it..
No we do not have an
No we do not have an example/demo yet.. but if you have a scenario, we could help you implement it..
asankha
Is simple, I would to send a
Is simple, I would to send a BIG XML file to a webservice, and it repond me with the time it takes to receive the file.
Thanks
Sure, use the sample
Sure, use the sample MTOMSwASampleService, and the sample # 51 configuration and transfer a huge file using MTOM.. You will need to enable caching for MTOM on the axis2.xml as
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments" locked="false">true</parameter>
<parameter name="attachmentDIR" locked="false">/tmp</parameter>
<parameter name="sizeThreshold" locked="false">4000</parameter>
Just now I transferred a file of 123MB just fine..
asankha
I do IT.
I do IT.
I transferred a file of 37 MB and say this
[java] Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
[java] at java.util.Arrays.copyOf(Arrays.java:2786)
[java] at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:133)
[java] at com.sun.mail.util.ASCIIUtility.getBytes(ASCIIUtility.java:248)
[java] at javax.mail.internet.MimeBodyPart.<init>(MimeBodyPart.java:175)
[java] at org.apache.axiom.attachments.PartOnMemory.<init>(PartOnMemory.java:34)
[java] at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
[java] at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
[java] at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
[java] at org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder.getDataHandler(MTOMStAXSOAPModelBuilder.j
ava:104)
[java] at org.apache.axiom.om.impl.llom.OMTextImpl.getDataHandler(OMTextImpl.java:324)
[java] at samples.userguide.MTOMSwAClient.sendUsingMTOM(Unknown Source)
[java] at samples.userguide.MTOMSwAClient.main(Unknown Source)
[java] Java Result: 1
I change all de axis2.xml in the wso folder:
<!-- ================================================= -->
<!-- Parameters -->
<!-- ================================================= -->
<parameter name="hotdeployment">true</parameter>
<parameter name="hotupdate">false</parameter>
<parameter name="enableMTOM">true</parameter>
<parameter name="enableSwA">false</parameter>
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">/tmp</parameter>
<parameter name="sizeThreshold">4000</parameter>
Please if I'm wrong explain my all the steps.
I have 2 java virtual machines ( The server and the ESB) This not change.
But when execute ant in the client appear 2 java virtual machines more, 1 of this cause the exception. Then, Is fault of the client?
Yes, this is definitely a
Yes, this is definitely a client side problem (confirmed by your stack trace..) However, when I tried the example transfer, my client ran just fine.. and without changing the client's axis2.xml - i.e. I only changed the ESB's axis2.xml to enable MTOM caching
Is the client and ESB on the same machine?
asankha
All is in the same
All is in the same machine.
Now I change only the ESB's axis2.xml, but happens the same thing. The heap of the Java virtual machine EXPLODE xD
Thanks for your help, tell mes if you have an idea.
Again, I can confirm that
Again, I can confirm that the sample 51 runs as expected without any issues - using a fresh ESB 1.6 release installation
I can transfer a file of ~123MB when I uncomment the following from the ESB axis2.xml
<!--Uncomment if you want to enable file caching for attachments -->
<parameter name="cacheAttachments" locked="false">true</parameter>
<parameter name="attachmentDIR" locked="false">/tmp</parameter>
<parameter name="sizeThreshold" locked="false">4000</parameter>
and the file transfers back and forth and diff shows me that the results are correct.
My laptop is a dual core 2GB ram system, and I use JDK 1.5.0_13. New JDK's correctly 'guess' server class systems, and adjust heap memory etc, looking at whats available. But on a low end desktop environment, unless you specify the Java "-Xms" and "-Xmx" parameters for the heap size, it could start from as little as 16MB
I am not experienced to comment on the memory use for MTOM by axis2 clients, but you could try increasing the heap for your client say "-Xms128m -Xmx256M" when starting it..
asankha
I can change de heap of the
I can change de heap of the server, but I can't change de heap of the client. :(
You can.. just edit the
You can.. just edit the build.xml and add the JVM args as follows
<target name="optimizeclient" depends="compile">
<java classname="samples.userguide.MTOMSwAClient"
classpathref="javac.classpath" fork="true">
<sysproperty key="opt_mode" value="${opt_mode}"/>
<sysproperty key="opt_url" value="${opt_url}"/>
<sysproperty key="opt_file" value="${opt_file}"/>
<sysproperty key="javax.net.ssl.trustStore" value="./../../webapp/WEB-INF/lib/trust.jks"/>
<sysproperty key="javax.net.ssl.trustStorePassword" value="password"/>
<sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/>
<jvmarg value="-Xms256m"/>
<jvmarg value="-Xmx256m"/>
</java>
</target>
It works, but is a bit slow.
It works, but is a bit slow. 124 M ~ 1min 1 sec
I supose that is slow why it transforms the message, I'm wrong?
the example # 51 sends and
the example # 51 sends and gets it back.. so if it took 1 minute, that was to send and get the file back again to the client