Hi,
I'm not sure if this is the right place to send this email, but we're a bit stuck and we *think* it might be a bug.
We're using Axis (1.3) with Castor (1.0M1). When we encode our Java objects back into XML, we get very strange output. Our tags have no names, but they all have their own namespaces!
eg.
<
LocationCode="AGP" CodeContext="IATA"
xmlns="ArrivalAirport"/>
From our point of
view, we were expecting:
<ArrivalAirport
LocationCode="AGP" CodeContext="IATA"/>
We've been debugging through the code and we're struggling to understand this bit of code in the "org.apache.axis.message.SOAPDocumentImpl.createElement" method:
if
(tagName.equalsIgnoreCase(Constants.ELEM_ENVELOPE))
new SOAPEnvelope();
if (tagName.equalsIgnoreCase(Constants.ELEM_HEADER))
return new SOAPHeader(soapenv, soapenv.getSOAPConstants());
if (tagName.equalsIgnoreCase(Constants.ELEM_BODY))
return new SOAPBody(soapenv, soapenv.getSOAPConstants());
if (tagName.equalsIgnoreCase(Constants.ELEM_FAULT))
return new SOAPEnvelope();
if (tagName.equalsIgnoreCase(Constants.ELEM_FAULT_DETAIL))
return new SOAPFault(new AxisFault(tagName));
else {
return new MessageElement("", prefix, localname);
}
new SOAPEnvelope();
if (tagName.equalsIgnoreCase(Constants.ELEM_HEADER))
return new SOAPHeader(soapenv, soapenv.getSOAPConstants());
if (tagName.equalsIgnoreCase(Constants.ELEM_BODY))
return new SOAPBody(soapenv, soapenv.getSOAPConstants());
if (tagName.equalsIgnoreCase(Constants.ELEM_FAULT))
return new SOAPEnvelope();
if (tagName.equalsIgnoreCase(Constants.ELEM_FAULT_DETAIL))
return new SOAPFault(new AxisFault(tagName));
else {
return new MessageElement("", prefix, localname);
}
The constructor that this calls is:
public MessageElement(String localPart, String prefix, String namespace)
We're confused because this either points to a bug in SOAPDocumentImpl (are the namespace and localname args the wrong way around?) or SOAPDocumentImpl is deliberately setting the name of the tag to be "" and the namespace to be the tag name!
Either way we were hoping for some inside info on what this MessageElement is supposed to represent once it's been constructed.
Out of curiousity, I made a
change to SoapDocumentImpl on my machine to swap the empty string
and localname args around and this DOES give us the XML we were
expecting (apart from spurious xmlns="" in every tag)
But we don't know if we've fixed a bug, or whether we're doing something wrong elsewhere to have caused this in the first place.
But we don't know if we've fixed a bug, or whether we're doing something wrong elsewhere to have caused this in the first place.
so any help would be greatly appreciated!
David
