You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/07/08 23:36:18 UTC
DO NOT REPLY [Bug 10566] New: -
xmlns="" added to every literal element instance
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10566>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10566
xmlns="" added to every literal element instance
Summary: xmlns="" added to every literal element instance
Product: Axis
Version: beta-2
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization/Deserialization
AssignedTo: axis-dev@xml.apache.org
ReportedBy: scheu@us.ibm.com
Here is an email that I received from Dirk WollScheid.
The failure only occurs with the literal encoding style. Dirk suggested
a patch to the serialization code that prevents the xmlns="" from being
generated. (My feeling is that this hides the real problem.)
---------------------------------
Note from Dik:
When I tell Axis to use literal encoding I get this output for my test case:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<method1 xmlns="urn:myNamespace">
<testParam xsi:type="ns1:Element" xmlns:ns1="http://xml.apache.org/xml-soap">
<xsd1:A xmlns:xsd1="urn:myNamespace" xmlns="">
<xsd1:B xmlns="">
<xsd1:C xmlns="">foo bar</xsd1:C>
</xsd1:B>
</xsd1:A>
</testParam>
</method1>
</soapenv:Body>
</soapenv:Envelope>
Somehow Axis inserts these dummy default namespace declarations - xmlns="" in
there. Here's my updated test case. I also tried if things change when I qualidy
the childs of A, but it doesn't seem to matter.
public static void main(String[] args) {
MessageContext msgContext = new MessageContext(new
AxisServer());
/*
String req =
"<xsd1:A xmlns:xsd1='urn:myNamespace'>"
+ "<B>"
+ "<C>foo bar</C>"
+ "</B>"
+ "</xsd1:A>";
*/
String req =
"<xsd1:A xmlns:xsd1='urn:myNamespace'>"
+ "<xsd1:B>"
+ "<xsd1:C>foo bar</xsd1:C>"
+ "</xsd1:B>"
+ "</xsd1:A>";
try {
StringWriter stringWriter=new StringWriter();
StringReader reqReader = new StringReader(req);
InputSource reqSource = new InputSource(reqReader);
DocumentBuilder xdb =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = xdb.parse(reqSource );
String msgString = null;
SOAPEnvelope msg = new SOAPEnvelope();
RPCParam arg1 = new RPCParam("urn:myNamespace",
"testParam", document.getFirstChild());
arg1.setXSITypeGeneration(false);
RPCElement body = new RPCElement("urn:myNamespace",
"method1", new Object[] { arg1 });
msg.addBodyElement(body);
body.setEncodingStyle(Constants.URI_LITERAL_ENC);
SerializationContext context = new
SerializationContextImpl(stringWriter, msgContext);
msg.output(context);
msgString = stringWriter.toString();
System.out.println(msgString);
} catch (Exception e) {
e.printStackTrace();
}
}
Can you please have a look at this too? If it seems wrong to you too I can open
a bugzilla bug.