Maybe I'm missing something, but I don't see how to get the JAXBDataBinding in there. I'm not creating a jaxws:client or jaxws:endpoint declaration in my configuration, so I can't pass the bean into anything. I've been looking at the beans through the debugger, and at some level there is a bean that holds a ServiceImpl where I could set the JAXBDataBinding, but I don't see a publically accessible way to retrieve the field without starting at the CXF API level. Can I set some magic property in the request context?
-----Original Message----- From: Daniel Kulp [mailto:[email protected]] Sent: Saturday, July 03, 2010 1:45 PM To: [email protected] Cc: Vanore, Gregory Subject: Re: Customize JAXB namespace prefixes for JAXWS API created endpoints Any chance you could create a simple testcase that shows this. It should definitely be allowed to define (or redefine) the namespace there. The output may not be perfectly what you want, but it should work. Dan On Thursday 01 July 2010 10:50:50 am Vanore, Gregory wrote: > I see in the documentation how to use a JAXBDataBinding to customize > namespace prefixes for endpoints that I enumerate through the Spring > configuration mechanism. I have a client that is strictly using the > JAX-WS API to create services: Service.create(...) and then > service.getPort(...). > > When I create a W3CEndpointReference, extra namespaces are injected into > it: > > <EndpointReference xmlns="http://www.w3.org/2005/08/addressing"> > <Address>http://localhost:8888/test</Address> > <ReferenceParameters> > <elem xmlns="" > xmlns:ns2="http://www.w3.org/2005/08/addressing" > xmlns:wsa="http://www.w3.org/2005/08/addressing">test</elem> > </ReferenceParameters> > <Metadata/> > </EndpointReference> > > The problem comes when I set this into my request message. JAXB tries > to utilize ns2, and then declares a collision when it encounters the > endpoint reference, such as: > > W3CEndpointReference epr = > eprBuilder.address("http://localhost:8888/test").referenceParameter(e).b > uild(); > SubscribeService request = new SubscribeService(); > request.setTopic("theTopic"); > request.setConsumerReference(epr); > ServiceResponse response = service().subscribeTo(request); //no > luck > > javax.xml.ws.soap.SOAPFaultException: The namespace > xmlns:ns2="http://service.com/service" could not be added as a namespace > to "elem": The namespace prefix "ns2" > > I feel the best strategy is to use the namespace mapping to fix certain > common URLs to specific prefixes. If you have other ideas I'll > certainly listen... > > Thanks, > Greg -- Daniel Kulp [email protected] http://dankulp.com/blog
