WIth JAXB 2.1.x (used in CXF 2.1.x and 2.2), you can add some information to
the package-info.java for the types to handle this. You can add xmlns
attributes to the @XmlSchema annotation to add pre-defined namespace
mappings. From the javadoc:
javax.xml.bind.annotation.XmlSchema (
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "po",
namespaceURI="http://www.example.com/myPO1"),
@javax.xml.bind.annotation.XmlNs(prefix="xs",
namespaceURI="http://www.w3.org/2001/XMLSchema")
}
)
Dan
On Tuesday 30 December 2008 6:53:14 pm William Blackburn wrote:
> I have successfully created a wsdl-first web service using wsdl2java
> and CXF 2.2
>
> I am now testing and see that the default namespace in the soap
> requests/responses generated by cxf' client/server does not use an
> explicit namespace prefix, for example a CXF client might emit:
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
> <soap:Body>
> <RetrieveFormRequest xmlns="urn:ihe:iti:rfd:2007">
> <formID>_dummy</formID>
> <encodedResponse>true</encodedResponse>
> ... etc...etc...
>
> While the server would answer:
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
> <soap:Body>
> <RetrieveFormResponse xmlns="urn:ihe:iti:rfd:2007">
> <form>
> <Structured>
> ...etc...etc...
>
> I want the elements representing my various types to be explicitly
> prefixed, as in:
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
> xmlns:rfd="urn:ihe:iti:rfd:2007">
> <soap:Body>
> <rfd:RetrieveFormResponse >
> <rfd:form>
> <rfd:Structured>
> ...etc...etc...
>
> Is there any way to make this happen?
>
> Thanks very much.
--
Daniel Kulp
[email protected]
http://dankulp.com/blog