Package javax.xml.soap

Examples of javax.xml.soap.Name


        int num = children.size();

        Vector c = new Vector(num);
        for (int i = 0; i < num; i++) {
            MessageElement child = (MessageElement)children.get(i);
            Name cname = child.getElementName();
            if (cname.getURI().equals(name.getURI()) &&
                cname.getLocalName().equals(name.getLocalName())) {
                c.add(child);
            }
        }
        return c.iterator();
    }
View Full Code Here


    // Test JAXM methods...

    public void testName() throws Exception {
        SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
        Name n = env.createName("local", "pref", "urn:blah");
        assertEquals("local part of name did not match", "local",
                     n.getLocalName());
        assertEquals("qname of name did not match", "pref:local",
                     n.getQualifiedName());
        assertEquals("prefix of name did not match", "pref",
                     n.getPrefix());
        assertEquals("uri of name did not match", "urn:blah",
                     n.getURI());
        Name n2 = env.createName("loc");
        assertEquals("local part of name2 did not match", "loc",
                     n2.getLocalName());
    }
View Full Code Here

        MessageElement parent = new MessageElement("parent.names",
                                                "parent",
                                                "parns",
                                                null,
                                                dc);
        Name c1 = new PrefixedQName("child1.names", "child1" ,"c1ns");
        SOAPElement child1 = parent.addChildElement(c1);
        SOAPElement child2 = parent.addChildElement("child2");
        SOAPElement child3 = parent.addChildElement("child3.names", "parns");
        SOAPElement child4 = parent.addChildElement("child4",
                                                    "c4ns",
View Full Code Here

            Detail detail = faultElement.getDetail();
            if ( detail == null ) {
              detail = faultElement.addDetail();
            }
           
            Name stname = MessageUtil.createJMSName("StackTrace");
            SOAPElement entryEle = detail.addDetailEntry(stname);
                     
            //get stack trace
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            PrintStream ps = new PrintStream (baos);
View Full Code Here

         */
        SOAPBody soapBody = soapEnvelope.getBody();
        /**
         * Create a name object. with name space http://www.sun.com/imq.
         */
        Name name = soapEnvelope.createName("HelloWorld", "hw", "http://www.sun.com/imq");
        /**
         * Add child element with the above name.
         */
        SOAPElement element = soapBody.addChildElement(name);

View Full Code Here

        SOAPElement parent = new MessageElement("parent.names",
                                                "parent",
                                                "parns",
                                                null,
                                                dc);
        Name c1 = new PrefixedQName("child1.names", "child1" ,"c1ns");
        SOAPElement child1 = parent.addChildElement(c1);
        SOAPElement child2 = parent.addChildElement("child2");
        SOAPElement child3 = parent.addChildElement("child3.names", "parns");
        SOAPElement child4 = parent.addChildElement("child4",
                                                    "c4ns",
View Full Code Here

    public void testAttributes() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
        SOAPBody body = envelope.getBody();

        Name name1 = envelope.createName("MyAttr1");
        String value1 = "MyValue1";
        Name name2 = envelope.createName("MyAttr2");
        String value2 = "MyValue2";
        Name name3 = envelope.createName("MyAttr3");
        String value3 = "MyValue3";
        body.addAttribute(name1, value1);
        body.addAttribute(name2, value2);
        body.addAttribute(name3, value3);
        java.util.Iterator iterator = body.getAllAttributes();
        assertTrue(getIteratorCount(iterator) == 3);
        iterator = body.getAllAttributes();
        boolean foundName1 = false;
        boolean foundName2 = false;
        boolean foundName3 = false;
        while (iterator.hasNext()) {
            Name name = (Name) iterator.next();
            if (name.equals(name1))
                foundName1 = true;
            else if (name.equals(name2))
                foundName2 = true;
            else if (name.equals(name3))
                foundName3 = true;
        }
        assertTrue(foundName1 && foundName2 && foundName3);
    }
View Full Code Here

        int num = children.size();

        Vector c = new Vector(num);
        for (int i = 0; i < num; i++) {
            MessageElement child = (MessageElement)children.get(i);
            Name cname = child.getElementName();
            if (cname.getURI().equals(name.getURI()) &&
                cname.getLocalName().equals(name.getLocalName())) {
                c.add(child);
            }
        }
        return c.iterator();
    }
View Full Code Here

    public void testSOAPEnvelope() throws Exception {
        // Create an example SOAP envelope
        SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
        SOAPHeader h = env.getHeader();
        SOAPBody b = env.getBody();
        Name heName = env.createName("localName", "prefix", "http://uri");
        SOAPHeaderElement he = h.addHeaderElement(heName);
        he.setActor("actor");

        // Serialize the SOAP envelope
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream os = new ObjectOutputStream(bos);
        os.writeObject(env);

        // Deserializet the SOAP envelope
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream is = new ObjectInputStream(bis);
        SOAPEnvelope env2 = (SOAPEnvelope)is.readObject();

        // Check that the SOAP envelope survived the round trip
        SOAPHeader h2 = env2.getHeader();
        SOAPHeaderElement he2 = (SOAPHeaderElement)h2.
            examineHeaderElements("actor").next();
        Name heName2 = he2.getElementName();
        assertEquals("Local name did not survive java ser+deser",
                     heName.getLocalName(), heName2.getLocalName());
        assertEquals("Prefix did not survive java ser+deser",
                     heName.getPrefix(), heName2.getPrefix());
        assertEquals("URI did not survive java ser+deser",
                     heName.getURI(), heName2.getURI());
    }
View Full Code Here

        Iterator iter = header.examineHeaderElements( actorURI );
        while ( iter.hasNext() )
        {
            SOAPHeaderElement headerElem = (SOAPHeaderElement) iter.next();
            Name headerName = headerElem.getElementName();

            if ( headerName.getLocalName().equals( keyName.getLocalPart() )
                    && headerName.getURI().equals( keyName.getNamespaceURI() ) )
            {
                // found my header element;
                return headerElem;
            }
        }
View Full Code Here

TOP

Related Classes of javax.xml.soap.Name

Copyright © 2018 www.massapicom. 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.