You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Asif Ali <as...@yahoo.com> on 2012/08/01 11:21:46 UTC

Turn off MTOM feature in the client code to avoid xop generation

Hi,
I have written a client code to consume a service. The wsdl contains a
schema element of type base64encoder. CXF is sending the content of that
element using MTOM attachment since it is binary data but the service
provider is unable to retrieve the content through attachment due to
framework limitations. I have tried to turn off the MTOM feature by adding
MTOMFeature class instance to the JaxWSProxyFactoryBean but not able to
because MTOMFeature class is not a subclass of AbstractFeature class.

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
javax.xml.ws.soap.MTOMFeature mtom = new MTOMFeature(false);
factory.getFeatures().add(mtom); // Compilation Error....
factory.setServiceClass(ESignExternalListDocumentForSigner.class);
factory.setAddress("https://127.0.0.1:29528/e-Sign/ListDocumentForSigner");
factory.create();

I cannot go for a change in the schema because the service provider also has
to accept the change. I have also tried the below option which does not seem
to be working.

SOAPBinding sbinding = (SOAPBinding)bp.getBinding();
sbinding.setMTOMEnabled(false);

Please suggest how to resolve the compilation error.

Thanks in Advance,
Asif Ali Mohammed.



--
View this message in context: http://cxf.547215.n5.nabble.com/Turn-off-MTOM-feature-in-the-client-code-to-avoid-xop-generation-tp5711807.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Turn off MTOM feature in the client code to avoid xop generation

Posted by Asif Ali <as...@yahoo.com>.
Hi Daniel,

I tried both the options but the xop generation does not stop. The binary
data still goes as an attachment.

Thanks,
Asif Ali Mohammed.



--
View this message in context: http://cxf.547215.n5.nabble.com/Turn-off-MTOM-feature-in-the-client-code-to-avoid-xop-generation-tp5711807p5711936.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Turn off MTOM feature in the client code to avoid xop generation

Posted by Daniel Kulp <dk...@apache.org>.
The simplest may be to do :

((BindingProvider)proxy).getRequestContext()
  .put("mtom-enabled", Boolean.FALSE)

after the proxy is created.  That said, the setMTOMEnabled should also do 
it.   If that doesn't help, it MAY be detecting that something thinks soap 
w/ attachments should be used (slightly different than MTOM).  You thus may 
also need to do:

((BindingProvider)proxy).getRequestContext()
  .put("write.attachments", Boolean.FALSE)


Dan


On Wednesday, August 01, 2012 02:21:46 AM Asif Ali wrote:
> Hi,
> I have written a client code to consume a service. The wsdl contains a
> schema element of type base64encoder. CXF is sending the content of that
> element using MTOM attachment since it is binary data but the service
> provider is unable to retrieve the content through attachment due to
> framework limitations. I have tried to turn off the MTOM feature by adding
> MTOMFeature class instance to the JaxWSProxyFactoryBean but not able to
> because MTOMFeature class is not a subclass of AbstractFeature class.
> 
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> javax.xml.ws.soap.MTOMFeature mtom = new MTOMFeature(false);
> factory.getFeatures().add(mtom); // Compilation Error....
> factory.setServiceClass(ESignExternalListDocumentForSigner.class);
> factory.setAddress("https://127.0.0.1:29528/e-Sign/ListDocumentForSigner")
> ; factory.create();
> 
> I cannot go for a change in the schema because the service provider also
> has to accept the change. I have also tried the below option which does
> not seem to be working.
> 
> SOAPBinding sbinding = (SOAPBinding)bp.getBinding();
> sbinding.setMTOMEnabled(false);
> 
> Please suggest how to resolve the compilation error.
> 
> Thanks in Advance,
> Asif Ali Mohammed.
> 
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Turn-off-MTOM-feature-in-the-client-code-
> to-avoid-xop-generation-tp5711807.html Sent from the cxf-dev mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com