You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cbwhitebu <cb...@gmail.com> on 2012/01/11 01:06:45 UTC

JaxWsServerFactoryBean - enabling MTOM

It looks like the Server.getEndpoint().getBinding() returns a cxf 
SoapBinding instead of a JaxWS SOAPBinding so the documented method for
enabling MTOM doesn't work. 

Is the following an acceptable workaround or is this a bug?

       JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        factory.setBus(BusFactory.getDefaultBus());
        factory.setServiceName(new QName("http://mediStor.org/x-rays",
                "xRayStorage"));
        factory.setEndpointName(new QName("http://mediStor.org/x-rays",
                "XRaySOAPPort"));
        factory.setServiceClass(FirstService.class);
        factory.setAddress("http://localhost:8080/xray");
        factory.setWsdlLocation("test.wsdl");
        factory.setInvoker(new JAXWSMethodInvoker(new
PerRequestFactory(factory
                .getServiceClass())));
        Server srv = factory.create();
        ((SoapBinding) srv.getEndpoint().getBinding()).getBindingInfo()
               .setProperty(Message.MTOM_ENABLED, true);


--
View this message in context: http://cxf.547215.n5.nabble.com/JaxWsServerFactoryBean-enabling-MTOM-tp5135629p5135629.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JaxWsServerFactoryBean - enabling MTOM

Posted by cbw <cb...@gmail.com>.
Daniel,

It looks like neither approach works. In both cases, I don't get the MTOM
interceptor added to the chain. Here is a dump of the interceptor chain.

Chain org.apache.cxf.phase.PhaseInterceptorChain@49b9ef36. Current flow:
  receive [PolicyInInterceptor, AttachmentInInterceptor]
  pre-stream [CertConstraintsInterceptor]
  post-stream [StaxInInterceptor]
  read [SAAJPreInInterceptor, WSDLGetInterceptor, ReadHeadersInterceptor,
SoapActionInInterceptor, StartBodyInterceptor]
  pre-protocol [SAAJInInterceptor, MEXInInterceptor,
MustUnderstandInterceptor]
  post-protocol [CheckFaultInterceptor]
  unmarshal [URIMappingInterceptor, DocLiteralInInterceptor,
SoapHeaderInterceptor]
  pre-logical [OneWayProcessorInterceptor]
  post-logical [MessageModeInInterceptor]
  pre-invoke [SwAInInterceptor]
  invoke [ServiceInvokerInterceptor]
  post-invoke [OutgoingChainInterceptor]

Chris

On Fri, Jan 13, 2012 at 8:57 AM, Daniel Kulp <dk...@apache.org> wrote:

> On Tuesday, January 10, 2012 4:06:45 PM cbwhitebu wrote:
> > It looks like the Server.getEndpoint().getBinding() returns a cxf
> > SoapBinding instead of a JaxWS SOAPBinding so the documented method for
> > enabling MTOM doesn't work.
>
> The "Server" object in this case is a CXF specific thing and thus are
> dealing
> with CXF APIs, not JAXWS.     If you really needed/wanted the JAX-WS stuff,
> you'd likely need to use the Endpoint.publish(....) method to create a
> JAX-WS
> Endpoint.
>
> > Is the following an acceptable workaround or is this a bug?
>
> That's fine.
>
> You could also try calling:
> factory.setBindingId(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
>
> prior to the create.  I think that would work.
>
> Dan
>
>
>
> >
> >        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
> >         factory.setBus(BusFactory.getDefaultBus());
> >         factory.setServiceName(new QName("http://mediStor.org/x-rays",
> >                 "xRayStorage"));
> >         factory.setEndpointName(new QName("http://mediStor.org/x-rays",
> >                 "XRaySOAPPort"));
> >         factory.setServiceClass(FirstService.class);
> >         factory.setAddress("http://localhost:8080/xray");
> >         factory.setWsdlLocation("test.wsdl");
> >         factory.setInvoker(new JAXWSMethodInvoker(new
> > PerRequestFactory(factory
> >                 .getServiceClass())));
> >         Server srv = factory.create();
> >         ((SoapBinding) srv.getEndpoint().getBinding()).getBindingInfo()
> >                .setProperty(Message.MTOM_ENABLED, true);
> >
> >
> > --
> > View this message in context:
> >
> http://cxf.547215.n5.nabble.com/JaxWsServerFactoryBean-enabling-MTOM-tp5135
> > 629p5135629.html Sent from the cxf-user mailing list archive at
> Nabble.com.
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: JaxWsServerFactoryBean - enabling MTOM

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday, January 10, 2012 4:06:45 PM cbwhitebu wrote:
> It looks like the Server.getEndpoint().getBinding() returns a cxf
> SoapBinding instead of a JaxWS SOAPBinding so the documented method for
> enabling MTOM doesn't work.

The "Server" object in this case is a CXF specific thing and thus are dealing 
with CXF APIs, not JAXWS.     If you really needed/wanted the JAX-WS stuff, 
you'd likely need to use the Endpoint.publish(....) method to create a JAX-WS 
Endpoint.  
 
> Is the following an acceptable workaround or is this a bug?

That's fine.

You could also try calling:
factory.setBindingId(SOAPBinding.SOAP11HTTP_MTOM_BINDING)

prior to the create.  I think that would work.

Dan



> 
>        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
>         factory.setBus(BusFactory.getDefaultBus());
>         factory.setServiceName(new QName("http://mediStor.org/x-rays",
>                 "xRayStorage"));
>         factory.setEndpointName(new QName("http://mediStor.org/x-rays",
>                 "XRaySOAPPort"));
>         factory.setServiceClass(FirstService.class);
>         factory.setAddress("http://localhost:8080/xray");
>         factory.setWsdlLocation("test.wsdl");
>         factory.setInvoker(new JAXWSMethodInvoker(new
> PerRequestFactory(factory
>                 .getServiceClass())));
>         Server srv = factory.create();
>         ((SoapBinding) srv.getEndpoint().getBinding()).getBindingInfo()
>                .setProperty(Message.MTOM_ENABLED, true);
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/JaxWsServerFactoryBean-enabling-MTOM-tp5135
> 629p5135629.html Sent from the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com