Is it possible to specify the namespace prefix chosen by an axis ws-client
In one of my projects I have the problem that I have to call a web service, where the namespace prefixes are fixed and checked at server side. To my knowledge this is not in any way xml nor "webservice" compliant. Never the less, the server implementation won't change - so I am开发者_开发知识库 stuck with sending fixed prefixes for specific namespaces. Since I am using axis2 (1.4.1) with JAXB as framework, I was wondering if there is a way to specify the prefix for a namesapce for an axis webservice client.
Thanks!
Last, but not least, ... I found a solution for the problem:
You can define a custom namespace mapping @ the jaxb marshaller by adding the property 'com.sun.xml.bind.namespacePrefixMapper' to the marshaller.
For a custom namespace prefix mapper you can just extend the existing abstract class 'com.sun.xml.bind.marshaller.NamespacePrefixMapper' and override the method 'getPreferredPrefix' :).
I think one of my previous answers can help you?
How do I add a namespace reference to a SOAP response with Apache Axis2 and WSDL2Java
精彩评论