[ http://issues.apache.org/jira/browse/WSCOMMONS-74?page=comments#action_12430222 ] Ruchith Udayanga Fernando commented on WSCOMMONS-74: ----------------------------------------------------
Hi Rich, I ran into a yet another OM serialization issue yesterday during the WS-SX interop. :-( Consider the following XML: (Note the use of the default namespaces) -----------------------------------START----------------------------------- <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference URI="#uuid:a6dc659e-3dc3-4c0e-96ae-8fc74e533955"> <Transforms xmlns="http://www.w3.org/2000/09/xmldsig#"> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </Transforms> <DigestMethod xmlns="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue xmlns="http://www.w3.org/2000/09/xmldsig#">iz9UsE7Y6hHExQFUiqhKOeangec=</DigestValue> </Reference> </SignedInfo> <SignatureValue>mnka0NeLIs1RIukOulge9Z82+MGPMbRztggTcsA8QzOMCmLHZQKuMU98VwHlNdUqW52RWiQJa4TWlc4tjV/2tehxWBu+r9AhD6MuIz64EIK5QNoEr3/mBX6GPVhSp8KzBFIFdDuaOv0Vfdqvkdh/bXKe/CBnzwJaXE6BocufVTE=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIDDDCCAfSgAwIBAgIQb6U6bec4ZHW96T5N2A/NdTANBgkqhkiG9w0BAQUFADAwMQ4wDAYDVQQKDAVPQVNJUzEeMBwGA1UEAwwVT0FTSVMgSW50ZXJvcCBUZXN0IENBMB4XDTA1MTAyNzAwMDAwMFoXDTE4MTAyNzIzNTk1OVowQjEOMAwGA1UECgwFT0FTSVMxIDAeBgNVBAsTF09BU0lTIEludGVyb3AgVGVzdCBDZXJ0MQ4wDAYDVQQDDAVXc3NJUDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2X9ZWiek/59vvg+l/lmzWjBYiqoOuSI+ms3ief7RyhPNh/IrGE3VwU67HsygNeavE06S6xNfcNWUNLqEdRmd/29WnubNH7hWJsqp7rn8g/mxNVkynCkJ1saKuD8ILiKfNg0e8UUE9QzwEz1fxw81OR0SbDitfTrDj8Q/ouCgEaUCAwEAAaOBkzCBkDAJBgNVHRMEAjAAMDMGA1UdHwQsMCowKKImhiRodHRwOi8vaW50ZXJvcC5iYnRlc3QubmV0L2NybC9jYS5jcmwwDgYDVR0PAQH/BAQDAgSwMB0GA1UdDgQWBBQb1AYE+P8ue/8qbgUJOKoyDXFqaTAfBgNVHSMEGDAWgBTAnSj8wes1oR3WqqqgHBpNwkkPDzANBgkqhkiG9w0BAQUFAAOCAQEAeltzyUHj+/0i3Hsj5XvWrJ7mF+zBFwp7E6CPLP/urfMdl1VFaBttOCcdWRrm8GI3KsGQMV6dpzAykl1JDO7T6IMSMYA1/YTsSH9S8xoubL/7IGYj3izKZ9LrV7fJJOHOerKLgIk/0X8DzH15jwel271s6Nh6DiXqU2Hf0YUmauLAH+rbiuNLlUKM5UkP4BtGqPw+6tvyaUOa3fzJs92WB+j5x91/xmvNg+ZTp+TEfyINM3wZAHwoIzXtEViopCRsXkmLr+IBGszmUpZnPd2QuqDSSkQhlZmUAuNVPCTBoNuWBX/tvvAw3a3jl+DXB+Fn2JbRpoUdvkgAWCAJ6hrKgA==</X509Certificate> </X509Data> </KeyInfo> </Signature> -----------------------------------END----------------------------------- When I read this into OM and serialize it, the serialized form is incorrect : (Note the use of xmlns="" in the following output). -----------------------------------START----------------------------------- <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod xmlns="" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> <SignatureMethod xmlns="" Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> <Reference xmlns="" URI="#uuid:a6dc659e-3dc3-4c0e-96ae-8fc74e533955"> <Transforms xmlns="http://www.w3.org/2000/09/xmldsig#"> <Transform xmlns="" Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <Transform xmlns="" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> </Transforms> <DigestMethod xmlns="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <DigestValue xmlns="http://www.w3.org/2000/09/xmldsig#">iz9UsE7Y6hHExQFUiqhKOeangec=</DigestValue> </Reference> </SignedInfo> <SignatureValue>mnka0NeLIs1RIukOulge9Z82+MGPMbRztggTcsA8QzOMCmLHZQKuMU98VwHlNdUqW52RWiQJa4TWlc4tjV/2tehxWBu+r9AhD6MuIz64EIK5QNoEr3/mBX6GPVhSp8KzBFIFdDuaOv0Vfdqvkdh/bXKe/CBnzwJaXE6BocufVTE=</SignatureValue> <KeyInfo> <X509Data> <X509Certificate>MIIDDDCCAfSgAwIBAgIQb6U6bec4ZHW96T5N2A/NdTANBgkqhkiG9w0BAQUFADAwMQ4wDAYDVQQKDAVPQVNJUzEeMBwGA1UEAwwVT0FTSVMgSW50ZXJvcCBUZXN0IENBMB4XDTA1MTAyNzAwMDAwMFoXDTE4MTAyNzIzNTk1OVowQjEOMAwGA1UECgwFT0FTSVMxIDAeBgNVBAsTF09BU0lTIEludGVyb3AgVGVzdCBDZXJ0MQ4wDAYDVQQDDAVXc3NJUDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2X9ZWiek/59vvg+l/lmzWjBYiqoOuSI+ms3ief7RyhPNh/IrGE3VwU67HsygNeavE06S6xNfcNWUNLqEdRmd/29WnubNH7hWJsqp7rn8g/mxNVkynCkJ1saKuD8ILiKfNg0e8UUE9QzwEz1fxw81OR0SbDitfTrDj8Q/ouCgEaUCAwEAAaOBkzCBkDAJBgNVHRMEAjAAMDMGA1UdHwQsMCowKKImhiRodHRwOi8vaW50ZXJvcC5iYnRlc3QubmV0L2NybC9jYS5jcmwwDgYDVR0PAQH/BAQDAgSwMB0GA1UdDgQWBBQb1AYE+P8ue/8qbgUJOKoyDXFqaTAfBgNVHSMEGDAWgBTAnSj8wes1oR3WqqqgHBpNwkkPDzANBgkqhkiG9w0BAQUFAAOCAQEAeltzyUHj+/0i3Hsj5XvWrJ7mF+zBFwp7E6CPLP/urfMdl1VFaBttOCcdWRrm8GI3KsGQMV6dpzAykl1JDO7T6IMSMYA1/YTsSH9S8xoubL/7IGYj3izKZ9LrV7fJJOHOerKLgIk/0X8DzH15jwel271s6Nh6DiXqU2Hf0YUmauLAH+rbiuNLlUKM5UkP4BtGqPw+6tvyaUOa3fzJs92WB+j5x91/xmvNg+ZTp+TEfyINM3wZAHwoIzXtEViopCRsXkmLr+IBGszmUpZnPd2QuqDSSkQhlZmUAuNVPCTBoNuWBX/tvvAw3a3jl+DXB+Fn2JbRpoUdvkgAWCAJ6hrKgA==</X509Certificate> </X509Data> </KeyInfo> </Signature> -----------------------------------END----------------------------------- Seems like OM serialization is still broken :-(. I'll reopen this issue. Thanks, Ruchith > Incorrect namespace serialization > --------------------------------- > > Key: WSCOMMONS-74 > URL: http://issues.apache.org/jira/browse/WSCOMMONS-74 > Project: WS-Commons > Issue Type: Bug > Components: AXIOM > Reporter: Ruchith Udayanga Fernando > Assigned To: Rich Scheuerle > Priority: Blocker > Attachments: axiom_api_patch.txt, axiom_impl_patch.txt, > axiom_test_patch.txt, jaxsw_test_patch.txt, SerializationTest.java > > > Hi All, > I noticed that axiom doesn't serialize namespaces correctly. > 1.) Namespaces in qualified elements > For example we should be able to produce the following xml with the code that > follows: > <person1 xmlns="http://ws.apache.org/axis2/apacheconasia/06"> > <name>John</name> > <name>John12</name> > <age>34</age> > </person1> > OMFactory fac = OMAbstractFactory.getOMFactory(); > > OMNamespace ns = > fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06", ""); > OMElement personElem = fac.createOMElement("person", ns); > OMElement nameElem = fac.createOMElement("name", ns); > nameElem.setText("John"); > > OMElement ageElem = fac.createOMElement("age", ns); > ageElem.setText("34"); > > OMElement weightElem = fac.createOMElement("weight", ns); > weightElem.setText("50"); > > > //Add children to the person element > personElem.addChild(nameElem); > personElem.addChild(ageElem); > personElem.addChild(weightElem); > > String xml = personElem.toString(); > But right now this produces the following : > <person xmlns="http://ws.apache.org/axis2/apacheconasia/06"><name > xmlns="http://ws.apache.org/axis2/apacheconasia/06">John</name><age > xmlns="http://ws.apache.org/axis2/apacheconasia/06">34</age><weight > xmlns="http://ws.apache.org/axis2/apacheconasia/06">50</weight></person> > The repetition of the default namespace should be avoided. > This is the same even if we used a prefixed namespace. > 2.) Unqualified elements among qualified elements > > OMFactory fac = OMAbstractFactory.getOMFactory(); > OMNamespace ns = > fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06", ""); > OMElement personElem = fac.createOMElement("person", ns); > //Create and add an unqualified element > OMElement nameElem = fac.createOMElement("name", null); > nameElem.setText("John"); > personElem.addChild(nameElem); > OMElement ageElem = fac.createOMElement("age", ns); > ageElem.setText("34"); > > OMElement weightElem = fac.createOMElement("weight", ns); > weightElem.setText("50"); > personElem.addChild(ageElem); > personElem.addChild(weightElem); > System.out.println(personElem); > The above should produce the following : > <person xmlns="http://ws.apache.org/axis2/apacheconasia/06"><name > xmlns="">John</name><age>34</age><weight>50</weight></person> > But AXIOM right now produces : > <person > xmlns="http://ws.apache.org/axis2/apacheconasia/06"><name>John</name><age > xmlns="http://ws.apache.org/axis2/apacheconasia/06">34</age><weight > xmlns="http://ws.apache.org/axis2/apacheconasia/06">50</weight></person> > What do u folks think? > Thanks, > Ruchith > p.s. Added a test case -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
