Skip to content

SaajContentHandler shouldn't repeat namespace declarations [SWS-329] #483

@gregturn

Description

@gregturn

Sven Wündrich opened SWS-329 and commented

We have realized some WebServices with PayloadRootAnnotationMethodEndpointMapping and Jaxb2Marshaller. The resulting soap document is valid, but the namespace declarations are repeated on each element. The behavior depends on javax.xml.stream.isRepairingNamespaces implementation in the StaX OutputStream.

The repetition of the namespace declarations comes from SaajContentHandler.startElement(...). The statements

for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext();) {
String namespacePrefix = (String) iterator.next();
String namespaceUri = (String) namespaces.get(namespacePrefix);
child.addNamespaceDeclaration(namespacePrefix, namespaceUri);
}

adds the declarations. Now the Sun StaX (sjsxp.jar) removes the needless declarations and all is fine. But the BEA WLS StaX implementation leaves the declarations untouched.

Through JAXB2 all known namespaces are named on the first element (if there are used or not). So the resulting xml contains 70% namespace declarations and is very big. If there is no reason for the current implementation, please only add namespace declarations of the current element, not the start element.


Affects: 1.0.2

Referenced from: commits cf9515e

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions