You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Gregor Karlinger <gr...@cio.gv.at> on 2004/08/26 15:18:55 UTC

Unintentional namespace normalization

Hi,

I am facing the following problem with using Axis 1.2beta3 (nightly Build
from 2004-08-15) as a webservice client:

The SOAP message, which comes from the webservice over the wire, is the
following:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  <soapenv:Body>
    <CreateXMLSignatureResponse 
      xmlns="http://reference.e-government.gv.at/namespace/moa/20020822#"
      xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
      <SignatureEnvironment>
        <dsig:Signature 
          Id="signature-1-1"
          xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
          ...
        </dsig:Signature>
      </SignatureEnvironment>
    </CreateXMLSignatureResponse>
  </soapenv:Body>
</soapenv:Envelope>

However, if I take the soap body from the soap response with axis as
follows:

  Vector responses = (Vector) call.invoke(params);
  SOAPBodyElement response = (SOAPBodyElement) responses.get(0);
  Document root_response = response.getAsDocument();

then the namespace declaration from element dsig:Signature disappears, i.e.
serializing root_response leads to

<?xml version="1.0" encoding="UTF-8"?>
<CreateXMLSignatureResponse 
  xmlns="http://reference.e-government.gv.at/namespace/moa/20020822#" 
  xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
  <SignatureEnvironment>
    <dsig:Signature Id="signature-1-1">
      ...
    </dsig:Signature>
  </SignatureEnvironment>
</CreateXMLSignatureResponse>

Although the resulting XML document is still perfectly well-formed, this
behaviour of Axis is really bad in my context, since the
CreateXMLSignatureResponse acts only as a container and is thrown away later
in the processing. Then the subtree starting at the SignatureEnvironment 
element is not well-formed XML any more.

Can I change this behaviour of Axis? If not, I suggest to change the
behaviour since it is poison in lots of contexts, especially when dealing
with XML signatures.

Best Regards,
Gregor