Package javax.xml.soap

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


      SOAPMessage soapMessage = msgFactory.createMessage();
      SOAPEnvelope env = soapMessage.getSOAPPart().getEnvelope();
      SOAPBody body = env.getBody();

      Name name = soapFactory.createName("MyChild1");
      SOAPElement se = body.addChildElement(name);
      assertNotNull("Expected an element", se);

      assertEquals("Expected 1 child element", 1, getIteratorCount(body.getChildElements()));

      SOAPElement se2 = (SOAPElement)body.getChildElements().next();
View Full Code Here


      String u = "myURI";

      body.addNamespaceDeclaration(p, u);
      assertEquals(u, body.getNamespaceURI(p));

      SOAPElement se = body.addChildElement(s, p);
      assertNotNull("Expected an element", se);

      assertEquals("Expected 1 child element", 1, getIteratorCount(body.getChildElements()));

      SOAPElement se2 = (SOAPElement)body.getChildElements().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

    @Validated @Test
    public void testAddNamespaceDeclarationDefaultNamespace() throws SOAPException {
        SOAPMessage msg = MessageFactory.newInstance().createMessage();
        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
        SOAPBody body = envelope.getBody();
        SOAPElement element = body.addChildElement("test", "p", "urn:test");
        element.addNamespaceDeclaration("", "urn:ns");
        Attr attr = (Attr)element.getAttributes().getNamedItemNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns");
        assertEquals("urn:ns", attr.getValue());
    }
   
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

        SOAPMessage message = fact.createMessage();
        SOAPBody soapBody = message.getSOAPBody();

        QName qname1 = new QName("http://wombat.ztrade.com",
                                 "GetLastTradePrice", "ztrade");
        SOAPElement child = soapBody.addChildElement(qname1);
       
        assertFalse(child.getChildElements().hasNext());
       
        Document doc = child.getOwnerDocument();       
        String namespace = "http://example.com";
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.