Package javax.xml.soap

Examples of javax.xml.soap.SOAPEnvelope


    public void testSetElementQName2() {
        try {
            MessageFactory factory = MessageFactory.newInstance();
            SOAPMessage message = factory.createMessage();
            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();
            SOAPHeader header = envelope.getHeader();

            QName qname = new QName("qname");
            //Try and change element name of SOAPEnvelope (expect SOAPException)
            try {
                envelope.setElementQName(qname);
                fail("Did not throw expected SOAPException");
            } catch (SOAPException e) {
                //Caught expected SOAPException
            }
View Full Code Here


    public void testAddChildElement2() {
        boolean pass = true;
        try {
            SOAPMessage msg =
                    MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
            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;
View Full Code Here

    }

    public void testAddTextNode2() {
        try {
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();
            Iterator iStart = envelope.getChildElements();
            int countStart = getIteratorCount(iStart);
            SOAPElement se = envelope.addTextNode("<txt>This is text</txt>");
            if (se == null) {
                fail("addTextNode() did not return SOAPElement");
            } else if (!envelope.getValue().equals("<txt>This is text</txt>")) {
                String s = body.getValue();
                fail("addTextNode() did not return expected text, Returned " + s +
                        ", Expected <txt>This is text</txt>");
            }
            Iterator i = envelope.getChildElements();
            int count = getIteratorCount(i);
            i = envelope.getChildElements();
            if (count != ++countStart) {
                fail("Wrong iterator count returned of " +
                        count + ", expected " + countStart);
            } else {
                Object obj = null;
View Full Code Here

    }

    public void testRemoveAttribute() {
        try {
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();
            Name name = envelope.createName("MyAttr1");
            String value = "MyValue1";
            body.addAttribute(name, value);
            boolean b = body.removeAttribute(name);
            assertTrue("removeAttribute() did not return true", b);
            b = body.removeAttribute(name);
View Full Code Here

    }

    public void testRemoveAttribute2() {
        try {
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();

            QName name = new QName("MyAttr1");
            String value = "MyValue1";
            body.addAttribute(name, value);
            boolean b = body.removeAttribute(name);
View Full Code Here

    }

    public void testRemoveAttributeName() {
        try {
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();

            Name name = envelope.createName("MyAttr1");
            String value = "MyValue1";
            body.addAttribute(name, value);
            boolean b = body.removeAttribute(name);
            assertTrue(b);
View Full Code Here

    public void _testRemoveAttributeQName() {
        try {
            SOAPMessage msg =
                    MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();

            QName name = new QName("MyAttr1");
            String value = "MyValue1";
            body.addAttribute(name, value);
            boolean b = body.removeAttribute(name);
View Full Code Here

    public void testRemoveNamespaceDeclaration() {
        try {
            String prefix = "myPrefix";
            String uri = "myURI";
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();
            body.addNamespaceDeclaration(prefix, uri);
            boolean b = body.removeNamespaceDeclaration(prefix);
            assertTrue("removeNamespaceDeclaration() did not return true", b);
            b = body.removeNamespaceDeclaration(prefix);
            assertFalse("removeNamespaceDeclaration() did not return false", b);
View Full Code Here

    }

    public void _testSetEncodingStyle() {
        try {
            SOAPMessage msg = MessageFactory.newInstance().createMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPBody body = envelope.getBody();
            body.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING);
            try {
                body.setEncodingStyle("BOGUS");
                fail("Expected Exception did not occur");
            } catch (IllegalArgumentException e) {
View Full Code Here

    public void _testGetChildElements2() {
        try {
            MessageFactory fact = MessageFactory.newInstance();
            SOAPMessage message = fact.createMessage();
            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;
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPEnvelope

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.