Axiom changes the namespce prefix only in the namespace declaration
-------------------------------------------------------------------

                 Key: WSCOMMONS-509
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-509
             Project: WS-Commons
          Issue Type: Bug
            Reporter: Amila Chinthaka Suriarachchi


String xmlString = "<s:Envelope 
xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
                "   <s:Body>\n" +
                "      <s:Fault>\n" +
                "         <faultcode>s:Client</faultcode>\n" +
                "         <faultstring xml:lang=\"en-US\">The creator of this 
fault did not specify a Reason.</faultstring>\n" +
                "         <detail>\n" +
                "            <AppBaseFault i:type=\"AppDerivedFault\" 
xmlns=\"http://xwsinterop/soapwsdl/faults\"; 
xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\";>\n" +
                "               <ErrorInt>50</ErrorInt>\n" +
                "               <ErrorString>This is a test error string for 
fault tests.</ErrorString>\n" +
                "               <ErrorEmployee>\n" +
                "                  <Age>30</Age>\n" +
                "                  <Name>Indigo Developer</Name>\n" +
                "                  
<HireDate>2009-11-17T02:09:48.394-08:00</HireDate>\n" +
                "                  <ID>12345</ID>\n" +
                "                  <Manager>\n" +
                "                     <Age>50</Age>\n" +
                "                     <Name>Indigo Developer</Name>\n" +
                "                     
<HireDate>2009-11-17T02:09:48.394-08:00</HireDate>\n" +
                "                     <ID>34567</ID>\n" +
                "                     <Manager i:nil=\"true\"/>\n" +
                "                  </Manager>\n" +
                "               </ErrorEmployee>\n" +
                "            </AppBaseFault>\n" +
                "         </detail>\n" +
                "      </s:Fault>\n" +
                "   </s:Body></s:Envelope>";
        try {
            XMLStreamReader xmlStreamReader = 
StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
            StAXSOAPModelBuilder builder = new 
StAXSOAPModelBuilder(xmlStreamReader);
            SOAPEnvelope envelope = (SOAPEnvelope)builder.getDocumentElement();
            XMLStreamReader newReader = 
envelope.getBody().getFault().getDetail().getFirstElement().getXMLStreamReaderWithoutCaching();

            while (!newReader.isStartElement()){
                newReader.next();
            }
            System.out.println("Element name ==> " + newReader.getName());
            System.out.println("type ==> " + 
newReader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type";));
            System.out.println("Namespace ==> " + 
newReader.getNamespaceContext().getNamespaceURI(""));
            System.out.println("Namespace ==> " + 
newReader.getNamespaceContext().getNamespaceURI("axis2ns1"));
        } catch (XMLStreamException e) {

        }

This code produce following out put.

lement name ==> {http://xwsinterop/soapwsdl/faults}AppBaseFault
type ==> AppDerivedFault
Namespace ==> null
Namespace ==> http://xwsinterop/soapwsdl/faults

the namespace prefix has changed to axis2ns1 but type still have the previous 
value instead of axis2ns1:AppDerivedFault.

This give an exception at ADB.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to