cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vanore, Gregory" <Gregory.Van...@solers.com>
Subject Customize JAXB namespace prefixes for JAXWS API created endpoints
Date Thu, 01 Jul 2010 14:50:50 GMT
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

Mime
View raw message