Results 1 to 2 of 2

Thread: SaajContentHandler namespace declaration repeated

  1. #1
    Join Date
    Mar 2008
    Posts
    7

    Default SaajContentHandler namespace declaration repeated

    Hi
    We are using PayloadRootAnnotationMethodEndpointMapping and JAXB2Marshaller. When the soap result is generated the namespace declaration is repeated for each element. This results in huge xml
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <env:Header></env:Header>
    <env:Body>
    <ns1:RootElement xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">
    <ns1:Child1 xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">Childvalue </ns1:Child1>
    <ns2:Child2 xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">Childvalue</ns1:Child2>
    <ns3:Child3 xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">Childvalue</ns3:Child3>
    <ns4:Child4 xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">Childvalue</ns4:Child4>
    </ns1:RootElement>
    </env:Body>
    </env:Envelope>

    While debugging with my limited understanding I think that that the startElement method in SaajContentHandler is adding this
    for (Iterator iterator = namespaces.keySet().iterator(); iterator.hasNext() {
    String namespacePrefix = (String) iterator.next();
    String namespaceUri = (String) namespaces.get(namespacePrefix);
    child.addNamespaceDeclaration(namespacePrefix, namespaceUri);
    }
    I would appreciate help in preventing the redeclaration of namespace. In the sample above I would like the xml to be like this as the namespaces are already declared in parent.
    <ns1:RootElement xmlns:ns1="urn:main" xmlns:ns2="urn:common" xmlns:ns3="urn:types">
    <ns1:Child1>Childvalue </ns1:Child1>
    <ns2:Child2>Childvalue</ns1:Child2>
    <ns3:Child3>Childvalue</ns3:Child3>
    <ns4:Child4 >Childvalue</ns4:Child4>
    </ns1:RootElement>

  2. #2
    Join Date
    Apr 2008
    Location
    Germany/Dresden
    Posts
    1

    Default

    Hi,

    I have the same problem within BEA WLS 9.2. So I added an jira/improvement http://jira.springframework.org/browse/SWS-329.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •