Examples of StringResult


Examples of org.springframework.xml.transform.StringResult

    @Test
    public void testResponse() throws Exception {
        WebServiceMessage requestMock = createMock(WebServiceMessage.class);
        expect(requestMock.getPayloadSource()).andReturn(new StringSource("<request/>"));
        WebServiceMessage responseMock = createMock(WebServiceMessage.class);
        expect(responseMock.getPayloadResult()).andReturn(new StringResult());
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);
        expect(factoryMock.createWebServiceMessage()).andReturn(responseMock);
        MessageContext messageContext = new DefaultMessageContext(requestMock, factoryMock);

        Method response = getClass().getMethod("response", MyGenericType.class);
View Full Code Here

Examples of org.springframework.xml.transform.StringResult

    @Test
    public void testInvokeSource() throws Exception {
        WebServiceMessage requestMock = createMock(WebServiceMessage.class);
        WebServiceMessage responseMock = createMock(WebServiceMessage.class);
        expect(requestMock.getPayloadSource()).andReturn(new StringSource(CONTENTS));
        expect(responseMock.getPayloadResult()).andReturn(new StringResult());
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);
        expect(factoryMock.createWebServiceMessage()).andReturn(responseMock);
        replay(requestMock, responseMock, factoryMock);

        MessageContext messageContext = new DefaultMessageContext(requestMock, factoryMock);
View Full Code Here

Examples of org.springframework.xml.transform.StringResult

  private static final String WS_URI = "http://localhost:8080/ws-inbound-gateway/echoservice";
  private final WebServiceTemplate template = new WebServiceTemplate();

  @Test
  public void testWebServiceRequestAndResponse() {
    StringResult result = new StringResult();
    Source payload = new StringSource(
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
        "<echoRequest xmlns=\"http://www.springframework.org/spring-ws/samples/echo\">hello</echoRequest>");

    template.sendSourceAndReceiveToResult(WS_URI, payload, result);
    logger.info("RESULT: " + result.toString());
    assertThat(result.toString(), equalTo(
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
        "<echoResponse xmlns=\"http://www.springframework.org/spring-ws/samples/echo\">hello</echoResponse>"));
  }
View Full Code Here

Examples of org.springframework.xml.transform.StringResult

*/
public class XmlUtil {

  public static String docAsString(Document doc) {
    try {
      StringResult res = new StringResult();
      Transformer transformer = TransformerFactory.newInstance().newTransformer();
      transformer.transform(new DOMSource(doc), res);
      return res.toString();
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of org.springframework.xml.transform.StringResult

    Transformer transformer = createIndentingTransformer();

    transformer.setOutputProperty(OutputKeys.METHOD, "xml");

    try {
      StringResult streamResult = new StringResult();
      transformer.transform(new DOMSource(document), streamResult);
    } catch (Exception ex) {
      throw new IllegalStateException(ex);
    }
  }
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.