Instead of this
@XmlSeeAlso({User.class,Role.class,Function.class})
I would like something like this:
@XmlSeeAlso(Access.getWebServiceClasses())
Is it possible?
I want this since my webservice just contains interfaces and if I change the implementation I would just like to change in my factory so it returns the right classes instead of having to change in the webservice itself.
This isn’t possible, since annotation elements must be simple types (strings, primitives or classes (see annotations).
It is possible however (in CXF) to override
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass()method which, by default checks@XmlSeeAlsoof the interface. My implementation returns additionalObjectFactoryclasses.Chances are that you’re using
<jaxws:endpoint />in CXF’s Spring XML configuration. To be able to override this method, you have create few classes:org.apache.cxf.jaxws.spring.EndpointDefinitionParsermust use class derived fromorg.apache.cxf.jaxws.spring.EndpointDefinitionParser.SpringEndpointImpl(when using JAXWS 2.1) or fromorg.apache.cxf.jaxws22.spring.JAXWS22SpringEndpointImpl(JAXWS 2.2)super.setServiceFactory()passingorg.apache.cxf.jaxws.support.JaxWsServerFactoryBeanwith overridengetExtraClass()You have to provide your own
org.apache.cxf.jaxws.spring.NamespaceHandler(you can create derived class) for your own namespace (e.g.http://cxf.apache.org/jaxws/dynamic) which will register your own parser forjaxws:endpointelement:registerBeanDefinitionParser(“endpoint”, new EndpointDefinitionParser());
(sorry, I can’t provide full example – I’m writing from memory and CXF’s source code)