0 Replies Latest reply on Mar 19, 2008 6:09 AM by chavali

    AddChild() giving java.util.NoSuchElementException

    chavali

      Hi,

      Following code is giving java.util.NoSuchElementException. The exception is thrown at addChild() method.

      String xmlString = "<ns1:echo xmlns:ns1=\"http://ws.apache.org/axis2/xsd\"> <ns1:echo>Hello</ns1:echo> </ns1:echo>";
      XMLStreamReader parser2 = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlString));
      OMXMLParserWrapper builder2 = new StAXOMBuilder(parser2);
      OMElement documentElement = builder2.getDocumentElement();

      SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
      SOAPEnvelope envelope1 = fac.getDefaultEnvelope();
      envelope1.getBody().addChild( (OMNode)documentElement );
      newMsgContext.setEnvelope( envelope1 );

      Can anybody help in this regard.