Package javax.xml.soap

Examples of javax.xml.soap.SOAPBody.addChildElement()


        assertFalse(soapBody.getChildElements().hasNext());
       
        QName qname1 = new QName("http://wombat.ztrade.com",
                                 "GetLastTradePrice", "ztrade");
        SOAPElement child = soapBody.addChildElement(qname1);
        child.addTextNode("foo");
       
        assertTrue(child.getChildElements().hasNext());
       
        Node textNode = (Node)child.getChildElements().next();
View Full Code Here


        Iterator iStart = body.getChildElements();
        int countStart = getIteratorCount(iStart);

        final String bodyText = "This is the body text";

        SOAPElement se = body.addChildElement("Child");
        assertTrue(se != null);
        SOAPElement soapElement = se.addTextNode(bodyText);
        assertEquals(bodyText, soapElement.getValue());

        Iterator i = body.getChildElements();
View Full Code Here

    }

    public void testNonCommentText() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
        SOAPBody body = envelope.getBody();
        SOAPElement se = body.addChildElement("Child");
        se.addTextNode("This is text");
        Iterator iterator = se.getChildElements();
        Object o = null;
        while (iterator.hasNext()) {
            o = iterator.next();
View Full Code Here

    }

    public void testCommentText() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
        SOAPBody body = envelope.getBody();
        SOAPElement se = body.addChildElement("Child");
        se.addTextNode("<!-- This is a comment -->");
        Iterator iterator = se.getChildElements();
        Node n = null;
        while (iterator.hasNext()) {
            n = (Node)iterator.next();
View Full Code Here

            String s = "MyName1";
            String p = "MyPrefix1";
            String u = "myURI";
            SOAPBody body = MessageFactory.newInstance().createMessage().getSOAPBody();
            SOAPElement myse = body.addNamespaceDeclaration(p, u);
            SOAPElement se = body.addChildElement(s, p);
            if (se == null) {
                fail("SOAPElement was null");
            } else {
                Iterator i = body.getChildElements();
                int count = getIteratorCount(i);
View Full Code Here

            SOAPEnvelope soapEnvelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = msg.getSOAPBody();

            Name name = soapEnvelope.createName("MyChild1");
            //Add child element Name object with localName=MyChild1
            SOAPElement se = body.addChildElement(name);
            if (se == null) {
                fail("addChildElement() did not return SOAPElement");
                //pass = false;
            } else {
                //Find the child element just added
View Full Code Here

            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
            SOAPBody soapBody = soapEnvelope.getBody();

            Name name = soapEnvelope.createName("MyChild1");
            SOAPElement se = soapBody.addChildElement(name);
            Iterator childElementsCount = soapBody.getChildElements();
            Iterator childElements = soapBody.getChildElements();

            int childCount = 0;
            while (childElementsCount.hasNext()) {
View Full Code Here

            SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
            SOAPBody soapBody = soapEnvelope.getBody();

            //Name name = soapEnvelope.createName("MyChild1");
            QName name = new QName("MyChild1");
            SOAPElement se = soapBody.addChildElement(name);
            Iterator childElementsCount = soapBody.getChildElements();
            Iterator childElements = soapBody.getChildElements();

            int childCount = 0;
            while (childElementsCount.hasNext()) {
View Full Code Here

            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();

            Name name = envelope.createName("MyChild");
            SOAPElement se = body.addChildElement(name);
            assertNotNull(se);
            Iterator childs = body.getChildElements(name);
            int childElementCount = 0;
            for (int a = 0; childs.hasNext(); a++) {
                childs.next();
View Full Code Here

            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();

            QName qname1 = new QName("http://fooURI.com", "fooElement", "foo");
            QName qname2 = new QName("http://foo2URI.com", "fooElement2", "foo2");
            SOAPElement se = body.addChildElement(qname1);
            QName qname = se.getElementQName();
            se = se.setElementQName(qname2);
            qname = se.getElementQName();

            if (!qname.getNamespaceURI().equals(qname2.getNamespaceURI()) ||
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.