unsubscribe On 1 November 2012 14:47, 朱宾 <[email protected]> wrote:
> Hi, > > I'm trying to extend the JAX-WS web service in CXF and want to override the > MTOM feature defined in annotation of the web service implementation class, > but my changes seems didn't take effect. Can you take a look at my steps > and give some suggestions? > > I find that in the JaxWsServiceFactoryBean.java in current CXF code, there > are following variables defined for features including MTOM Feature: > private List<WebServiceFeature> setWsFeatures; > private List<WebServiceFeature> wsFeatures; > The constructor of JaxWsServiceFactoryBean will invoke > "JaxWsServiceFactoryBean.loadWSFeatureAnnotation()" method to set > "wsFeatures" according to the features defined in annotations. > But the public method "JaxWsServiceFactoryBean.setWsFeatures()" can only > allow me to set the "setWsFeatures". > In JaxWsServiceFactoryBean.create() method which will retrurn a Sevice > obeject, it will invoke the following methods: > #1 org.apache.cxf.service.Service s = super.create(); > #2 setMTOMFeatures(s.getDataBinding()); > > In #1 step, it will create a Service object using the "setWsFeatures", this > is what I desired since I can set the "setWsFeatures" variable by > "JaxWsServiceFactoryBean.setWsFeatures()" method. > However, In #2 step, it will set the feature in the service according to > "wsFeatures" variable which I can't change from outside. > But I can change the MTOM Feature in the returned Service object by > " JaxWsServiceFactoryBean.create() " method using similar code to "#2 > setMTOMFeatures(s.getDataBinding())" using the MTOM feature I defined. > > After this changes, I can see that the MTOM feature in Service object is > the one I defined, however, the output of my test case just comes out the > result that The MTOM Feature I defined didn't take effect, but the one in > Annotation is taking effect. > > Any ideas on this? Is there anywhere else in CXF will reset the MTOM > feature in Service Object using annotations which I didn't realize? Thanks > in advance. >
