4 Replies Latest reply on Feb 8, 2011 10:39 AM by hvnter

    Namespace declaration in every element of web service respon

    gori

      In the response we recieve from our web service, the declaration of the namespace (xmlns:ns1="http://our.website/services/types") is repeated in every element even though only one declaration would do in the top element (ns1:myMethodResponse). Is there a way we can tell JBoss not to generate a namespace declaration if the parent element already belongs to the same namespace ?

      We use JBoss 4.0.4.GA

      Below is the response :

      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header/>
       <env:Body>
       <ns1:myMethodResponse xmlns:ns1="http://our.website/services/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <ns1:header>
       <ns1:version xmlns:ns1="http://our.website/services/types">1.0</ns1:version>
       <ns1:senderTime xmlns:ns1="http://our.website/services/types">2006-07-17T13:06:48.867Z</ns1:senderTime>
       <ns1:senderId xmlns:ns1="http://our.website/services/types">CommonBank</ns1:senderId>
       <ns1:language xmlns:ns1="http://our.website/services/types">NL</ns1:language>
       <ns1:systemSoftwareVersion xmlns:ns1="http://our.website/services/types">4.00.00.0033</ns1:systemSoftwareVersion>
       </ns1:header>
       <ns1:myMethodResponse xsi:type="ns1:myMethodResponseV1DTO">
       <ns1:checkedAccountNumbers xmlns:ns1="http://our.website/services/types">
       <ns1:checkedAccountNumber xmlns:ns1="http://our.website/services/types">
       <ns1:accountNumber xmlns:ns1="http://our.website/services/types">BE06792503601622</ns1:accountNumber>
       <ns1:timestampLastAvailableDocument xmlns:ns1="http://our.website/services/types">2006-05-05T00:00:00.000Z</ns1:timestampLastAvailableDocument>
       </ns1:checkedAccountNumber>
       ...
       </ns1:checkedAccountNumbers>
       </ns1:myMethodResponse>
       </ns1:myMethodResponse>
       </env:Body>
      </env:Envelope>
      


        • 1. Re: Namespace declaration in every element of web service re
          thomas.diesler

          What version of JBossWS is this?
          What style/use is this?

          • 2. Re: Namespace declaration in every element of web service re
            nerbrate

            I'm wondering about the exact same thing.
            We use jbossws-1.0.2.GA on jboss-4.0.4.GA
            document, literal, wrapped (style, use, paramstyle)
            It is a jsr181 ws-endpoint with a ejb3 stateless session bean service endpoint.

            From the response generated by our web-service:

            <ns_doc:doc xmlns:ns_doc='http://service.our.website.org/jaws'>
             <ns_doc:docId>XXXXXXXXX</ns_doc:docId>
             <ns_doc:documents>
             <ns_doc:agreement xmlns:ns_doc='http://service.our.website.org/jaws'>
             <ns_doc:agreementCode xmlns:ns_doc='http://service.our.website.org/jaws' xsi:nil='1'/>
             <ns_doc:agreementType xmlns:ns_doc='http://service.our.website.org/jaws'>XXXXXXX</ns_doc:agreementType>
             <ns_doc:customerNumber xmlns:ns_doc='http://service.our.website.org/jaws'>12345678</ns_doc:customerNumber>
             <ns_doc:valid xmlns:ns_doc='http://service.our.website.org/jaws'>false</ns_doc:valid>
             </ns_doc:agreement>
             </ns_doc:documents>


            The node "doc" contains the declaration of the ns_doc namespace, and all nodes directly below this one does not. But all further nested elements contain the namespace declaration even though they all use the same namespace.

            In large messages the duplicated namespace declarations make the messages uneccessary large and very hard to read for a human.

            • 3. Re: Namespace declaration in every element of web service re
              thomas.diesler
              • 4. Re: Namespace declaration in every element of web service respon
                hvnter

                I encounter the same problem in JBossWS 2.0.1 SP2 (native).

                 

                When I print the XML from a Document object it looks fine. But when I add the same Document object to a SOAPBody object and then print the results from the method extractContentAsDocument() the namespace is declared in every element.

                 

                https://issues.jboss.org/browse/SOA-2869

                 

                Message was edited by: Albert Örwall