-
1. Re: Deploying ws with custom JAXBContext
jim.ma Jun 16, 2010 11:18 PM (in response to pulpo888)JBossWS retrieves the BindingCustomization from endpoint attachements: endpoint.getAttachement(BindingCustomization.class). One of the possible way might be get the endpoint from the EndpointRegistry and set your own BindingCustomization after this service is deployed. The getting endpoint and setting BindingCustomization code can be in a war or sar file depends this ws war file.
-
2. Re: Deploying ws with custom JAXBContext
pulpo888 Jun 18, 2010 2:02 PM (in response to jim.ma)I believe the class you're referring to is org.jboss.wsf.spi.deployment.Endpoint. This is what I was referring to when I said:
"JAXBIntroductions itself does this with a custom deployment aspect, attaching the annotation reader to local deployment objects that don't exist outside the deployment process."
JAXBIntros calls Endpoint.setAttachment. See http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.ws/jbossws-framework/3.3.0.CR2/org/jboss/wsf/framework/deployment/JAXBIntroDeploymentAspect.java#JAXBIntroDeploymentAspect
This class is not available to me before deployment, and I'm not sure how I can follow your suggestion to do it after deployment. Deployment is impossible if JBoss does not recognize that my class is a web service. Without the metadata (in annotations or some form), JBoss will try to deploy the class as a servlet, or it will fail. It doesn't appear to deploy it as a "webservice waiting for its metadata."
If you think there's a specific trick to convince JBoss to do a two-step deployment here I'm willing to look at it.
Regarding your last sentence, remember there's no war for this ws, it's programmatic deployment (which is otherwise working ok).
So it really seems like I need to be able to provide metadata to the deployment process. There is a standard way to do this using the JAXBContext and related classes. I just haven't yet found an interface or factory for injecting this into the deployment without writing my own deploymentaspect as the JAXBIntros people were forced to do back then. (See this thread from 2007, especially the second page: http://community.jboss.org/message/284953 ).
Maybe the JAXBContextFactory can somehow be used? I haven't been successful at that. And I don't want to affect all deployments, just the ones of this sort.
-
3. Re: Deploying ws with custom JAXBContext
jim.ma Jun 24, 2010 11:33 PM (in response to pulpo888)After jbossws webservice deployment , each endpoint will be registered in EndpointRegistry .
You can use jbossws SPI api to retrieve the EndpointRegistry , then get the endpoint you want to change and set your own BindingCustomization. After this setup , the soap request come in and the new BindingCustomization will be used to process the jaxb classes. This is just my draft thought about this problem, not really sure if this can work for your case.
-
4. Re: Deploying ws with custom JAXBContext
artemoboturov Aug 4, 2010 6:38 AM (in response to pulpo888)Example below is based on http://weblogs.java.net/blog/jitu/archive/2008/08/control_of_jaxb.html.
Specify custom JAXBContextFactory on top of your webserice. Create new JAXBRIContext and pass an annotation processor to it. BaseJAXBContextFactory is under your control.
At least jaxws-rt 2.1.5 must be used internally by jboss.
Hope this will help.
@WebService(....)
@UsesJAXBContext(BaseJAXBContextFactory.class)public class YourWebServiceBean{....}public class BaseJAXBContextFactory implements JAXBContextFactory{@Overridepublic JAXBRIContext createJAXBContext(SEIModel seiModel, List<Class> classes, List<TypeReference> typeReferences) throws JAXBException{Class[] arg = classes.toArray(new Class[classes.size()]);JAXBRIContext context = JAXBRIContext.newInstance(arg,typeReferences,null,seiModel.getTargetNamespace(),false,null // TODO: annotation processor should be put there);return context;}} -
5. Re: Deploying ws with custom JAXBContext
jdabrowski Apr 8, 2011 9:12 AM (in response to artemoboturov)I made it work with JBoss Web Services - Metro Server 3.3.1.GA in JBoss 6.0.0.20100911-M5 "Neo" but cannot with JBoss 6.0.0 Final (JBossWS is not supported anymore and default CXF and deployed Native seem to ignore the annotation).
Does any of CXF or Native support the @UsesJAXBContext and I'm doing something wrong?
Jacek
-
6. Re: Deploying ws with custom JAXBContext
asoldano Apr 14, 2011 9:21 AM (in response to jdabrowski)There's no jbws feature at the moment for setting a given annotation reader do be used by jaxb for an endpoint. The only supported customization is the JAXBIntros stuff. However, it should not be that hard to add an annotation similar to the Metro @UsesJAXBContext and a deployment processor that looks for that, properly populate a BindingCustomization object and attach it to the current deployment.
If someone is willing to work on this, please create and self-assign a JIRA, I can provide more detailed suggestions / directions if needed.