Package javax.xml.soap

Examples of javax.xml.soap.SOAPElement


    public void testText1() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
        Iterator iStart = envelope.getChildElements();
        int countStart = getIteratorCount(iStart);
        SOAPElement se = envelope.addTextNode("<txt>This is text</txt>");
        assertTrue(se != null);
        assertTrue(envelope.getValue().equals("<txt>This is text</txt>"));
        Iterator i = envelope.getChildElements();
        int count = getIteratorCount(i);
        assertTrue(count == countStart + 1);
View Full Code Here


        assertTrue(count == countStart + 1);
    }

    public void testText2() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
      SOAPElement se = envelope.addTextNode("This is text");
      Iterator iterator = se.getChildElements();
      Node n = null;
      while (iterator.hasNext()) {
            n = (Node)iterator.next();
            if (n instanceof Text)
                break;
View Full Code Here

    assertTrue(!t.isComment());
    }

    public void testText3() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
      SOAPElement se = envelope.addTextNode("<!-- This is a comment -->");
      Iterator iterator = se.getChildElements();
      Node n = null;
      while (iterator.hasNext()) {
            n = (Node)iterator.next();
            if (n instanceof Text)
                break;
View Full Code Here

    }

    // Test JAXM methods...

    public void testParentage() throws Exception {
        SOAPElement parent = new MessageElement();
        SOAPElement child = new MessageElement();
        child.setParentElement(parent);
        assertEquals("Parent is not as set", parent, child.getParentElement());
    }
View Full Code Here

        boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
        if (!outbound) {
            SOAPMessage message = ctx.getMessage();
            try {
                SOAPBody body = message.getSOAPBody();
                SOAPElement responseElem = CalculatorHandler.findElement(body, "multiply");
                if (responseElem != null) {
                    CalculatorHandler.verifyReferenceParameter(ctx);
                }
            } catch (SOAPException e) {
                e.printStackTrace();
View Full Code Here

    public static void testResponse(SOAPMessage message, String responseAction, String responseElement, int result, boolean mtom)
        throws SOAPException, IOException {
        message.writeTo(System.out);
       
        SOAPHeader header = message.getSOAPHeader();
        SOAPElement action = TestUtils.findElement(header, "Action");
        Assert.assertNotNull(action);
        Assert.assertEquals(responseAction, action.getValue());
       
        SOAPBody body = message.getSOAPBody();
        SOAPElement responseElem = TestUtils.findElement(body, responseElement);
        Assert.assertNotNull(responseElem);
        SOAPElement returnElem = TestUtils.findElement(responseElem, "return");
        Assert.assertNotNull(returnElem);
        Assert.assertEquals(String.valueOf(result), returnElem.getValue());           
    }
View Full Code Here

    }
   
    public static void testReferenceProperties(SOAPMessage message, String name, String value)
        throws SOAPException {
        SOAPHeader header = message.getSOAPHeader();
        SOAPElement propElement = TestUtils.findElement(header, name);           
        Assert.assertNotNull(propElement);
        Assert.assertEquals(value, propElement.getValue());
        String attrValue = propElement.getAttributeValue(IS_REFERENCE_PARAMETER);
        Assert.assertTrue(attrValue,
                          "true".equalsIgnoreCase(attrValue) || "1".equalsIgnoreCase(attrValue));
    }
View Full Code Here

    }

    @Test
    public void echo() throws SOAPException {
        SOAPMessage request = messageFactory.createMessage();
        SOAPElement element = request.getSOAPBody().addChildElement(new QName(EchoPayloadEndpoint.NAMESPACE, EchoPayloadEndpoint.LOCAL_PART));
        element.setTextContent("Hello World");

        SOAPConnection connection = connectionFactory.createConnection();

        SOAPMessage response = connection.call(request, url);
View Full Code Here

    private SaajSoapMessage createDeleteMessage() throws SOAPException {
        SOAPMessage saajMessage = messageFactory.createMessage();
        SOAPBody saajBody = saajMessage.getSOAPBody();
        SOAPBodyElement delete = saajBody.addBodyElement(new QName("http://example.com/fabrikam", "Delete"));
        SOAPElement maxCount = delete.addChildElement(new QName("maxCount"));
        maxCount.setTextContent("42");
        return new SaajSoapMessage(saajMessage);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public SOAPMessage invoke(SOAPMessage request) {
        SOAPMessage response = null;
        DBWSAdapter dbwsAdapter = (DBWSAdapter)xrService;

        SOAPElement body;
        try {
            body = getSOAPBodyElement(request);
        }
        catch (SOAPException se) {
            throw new WebServiceException(se.getMessage());
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPElement

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.