Package org.springframework.xml.transform

Examples of org.springframework.xml.transform.StringResult


        final Map<String, String> ns = Collections.singletonMap("ns", "http://example.com");

        server.expect(xpath("/ns:foo", ns).exists());

        template.sendSourceAndReceiveToResult(new StringSource("<request xmlns='http://example.com'/>"),
                new StringResult());
    }
View Full Code Here


        Source request = new StringSource("<request xmlns='http://example.com'/>");
        Source response = new StringSource("<response xmlns='http://example.com'/>");

        server.expect(anything()).andRespond(withPayload(response));

        StringResult result = new StringResult();
        template.sendSourceAndReceiveToResult(request, result);
        assertXMLEqual(result.toString(), response.toString());

        server.verify();
    }
View Full Code Here

        Source response = new StringSource("<response xmlns='http://example.com'/>");

        server.expect(anything()).andRespond(withPayload(response));
        server.expect(anything()).andRespond(withPayload(response));

        StringResult result = new StringResult();
        template.sendSourceAndReceiveToResult(request, result);
        assertXMLEqual(result.toString(), response.toString());

        server.expect(anything()).andRespond(withPayload(response));
    }
View Full Code Here

    public void fault() throws Exception {
        Source request = new StringSource("<request xmlns='http://example.com'/>");

        server.expect(anything()).andRespond(withClientOrSenderFault("reason", Locale.ENGLISH));

        StringResult result = new StringResult();
        template.sendSourceAndReceiveToResult(request, result);
    }
View Full Code Here

        assertEquals("Response has invalid fault string", faultString, soapFault.getFaultStringOrReason());
        assertEquals("Response has invalid fault locale", Locale.ENGLISH, soapFault.getFaultStringLocale());
    }

    private String getPayloadAsString(WebServiceMessage message) throws TransformerException {
        Result result = new StringResult();
        transformerHelper.transform(message.getPayloadSource(), result);
        return result.toString();
    }
View Full Code Here

        return result.toString();
    }
   
    private String getSoapEnvelopeAsString(SoapMessage message) throws TransformerException {
      DOMSource source = new DOMSource(message.getDocument());
        Result result = new StringResult();
        transformerHelper.transform(source, result);
        return result.toString();
    }
View Full Code Here

            SOAPMessage saajResponse = response.getSaajMessage();
            String[] headerValues = saajResponse.getMimeHeaders().getHeader(RESPONSE_HEADER_NAME);
            Assert.assertNotNull("Response has no header", headerValues);
            Assert.assertEquals("Response has invalid header", 1, headerValues.length);
            Assert.assertEquals("Response has invalid header values", RESPONSE_HEADER_VALUE, headerValues[0]);
            StringResult result = new StringResult();
            Transformer transformer = transformerFactory.newTransformer();
            transformer.transform(response.getPayloadSource(), result);
            assertXMLEqual("Invalid response", RESPONSE, result.toString());
        }
        finally {
            connection.close();
        }
    }
View Full Code Here

    @Test
    public void testGetPayloadSource() throws Exception {
        saajMessage.getSOAPPart().getEnvelope().getBody().addChildElement("child");
        Source source = soapMessage.getPayloadSource();
        StringResult result = new StringResult();
        transformer.transform(source, result);
        assertXMLEqual("Invalid source", "<child/>", result.toString());
    }
View Full Code Here

    public void testGetPayloadSourceText() throws Exception {
        SOAPBody body = saajMessage.getSOAPPart().getEnvelope().getBody();
        body.addTextNode(" ");
        body.addChildElement("child");
        Source source = soapMessage.getPayloadSource();
        StringResult result = new StringResult();
        transformer.transform(source, result);
        assertXMLEqual("Invalid source", "<child/>", result.toString());
    }
View Full Code Here

    }

    public void testGetPayloadSource() throws Exception {
        saajMessage.getSOAPBody().addChildElement("child");
        Source source = soapMessage.getPayloadSource();
        StringResult result = new StringResult();
        transformer.transform(source, result);
        assertXMLEqual("Invalid source", "<child/>", result.toString());
    }
View Full Code Here

TOP

Related Classes of org.springframework.xml.transform.StringResult

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.