users@jaxb.java.net

Namespace problem

From: Troy Hicks <troy.hicks_at_in-deptheng.com>
Date: Tue, 1 Mar 2011 14:26:21 -0500

I have a web service that is complaining about the xml namespace the
JAXB engine is sending to it.

In short the web service thinks I'm not sending any namespace info,
but I believe the information to be correct.  Accordingly, I have 2
questions:

1)  Is the information JAXB serializing into xml correct?
2)  Is it possible to tell JAXB to serialize all xml tags with an
explicit namespace prefix?

Details on the xml follow.
Thanks,
Troy

Error message from the server:
...snip...
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>com.ngc.cws.trackwebservice.TrackWebServiceException</faultstring>
<detail><ns:TrackWebServiceException>
<message>com.ngc.cws.trackxml_converter.util.ConversionException:
org.apache.xmlbeans.XmlException:  error: The document is not a
TrackList_at_urn:Navy:C2.tracks:1.0:types: document element namespace
mismatch expected "urn:Navy:C2.trakcs:1.0:types" got ""</message>
</ns:TrackWwebServiceException>
</detail>
</env:Fault>
...snip...


The problem originated with an insert tracks web service call to the
web service, and I think the complaint centers around the fact that
the xml tags used, do not have a prefix (e.g.<TrackInfo> vice
<theRightNameSpace:TrackInfo>)  Below is the first part of the xml
sent to the web service and I think the name space is properly
identified, what do you think?  (I'm typing this stuff in, so there
may be a typo or two, but the gist of the issue is that the default
xmlns is set to the one used by the web service so to me this seems
correct.) Also, the insertTracks tag has a defined default namespace,
which as I see it would apply to all tags inclusive of insertTracks.

<S:Envelope xmlns:S="http://schema.xmlsoap.org/soap/envelope/">
<S:Body>
<insertTracks xmlns="urn:Navy:C2.tracks:1.0:types"
xmlns:ns2="http://www.opengis.net/gml"
xmlns:ns3="http://www.w2.org/1999/xlink">
<TrackList>
<TrackKInfo>
<Track xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="Platform">
<Tactical-TrainingCode>Tactical</Tactical-TrainingCode>
<Identifiers>
....snip...

I used JAXB (version hudson-jaxb-ri-2.2-147) to perform the
serialization into xml