I have created a custom webservice using cxf, which takes zip as an
attachment.
In my code i have enabled mtom as mentioned in my context file below also
annotated interface MyService for enabling mtom.
<cxf:cxfEndpoint id="someWebserviceEndpoint" address="/someAddress"
serviceClass="com.company.xyz.MyService">
<cxf:properties>
<entry key="mtom-enabled" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
My route is defined as mentioned below.
from("cxf:bean:someWebserviceEndpoint")
.process('someProcessor')
.to("log:input")
In my processor i need to extract the zip file from message exchange using
zipUtility
public void process(Exchange exchange) throws MyException {
MyRequestHandler mrh= exchange.getIn().getBody(MyRequestHandler
.class);
System.out.println("cdr :-- "+ cdr);
try {
ZipInputStream zipInputStream = new ZipInputStream
(mrh.getAttachment().getInputStream());
ZipEntry zipEntry;
zipEntry = zipInputStream.getNextEntry();
if (zipEntry == null){
System.out.println("First call inside null");
}else{
System.out.println("First call inside not
null");
}} catch (IOException e1) {
}
try {
ZipInputStream zipInputStream1 = new ZipInputStream
(mrh.getAttachment().getInputStream());
ZipEntry zipEntry1;
zipEntry1 = zipInputStream1.getNextEntry();
if (zipEntry1 == null){
System.out.println("Second call inside null");
}else{
System.out.println("Second call inside not
null");
}} catch (IOException e1) {
}
..
}
After deploying when i test through soap ui i am getting below mentioned
output.
In case MTOM is disabled through soap UI: First call inside not null and
Second call inside not null
In case MTOM is enabledthrough soap UI: First call inside not null and
Second call inside null
Not sure why in case of mtom enabled, i am getting zipEntry as null for
second time.
Please let me know if i am doing anything wrong.
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-route-is-not-working-as-expected-when-mtom-is-enabled-tp5731252.html
Sent from the Camel - Users mailing list archive at Nabble.com.