Package org.springframework.xml.transform

Examples of org.springframework.xml.transform.StringSource


        }
    }

  @Test
    public void attachment() {
        template.sendSourceAndReceiveToResult(baseUrl + "/soap/attachment", new StringSource(messagePayload),
                new WebServiceMessageCallback() {

                    @Override
                    public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
                        SoapMessage soapMessage = (SoapMessage) message;
View Full Code Here


    public void domPox() throws Exception {
      WebServiceTemplate template = new WebServiceTemplate(new DomPoxMessageFactory());
        template.setMessageSender(new HttpComponentsMessageSender());
        String content = "<root xmlns='http://springframework.org/spring-ws'><child/></root>";
        StringResult result = new StringResult();
        template.sendSourceAndReceiveToResult(baseUrl + "/pox", new StringSource(content),
            result);
        assertXMLEqual(content, result.toString());
        try {
            template.sendSourceAndReceiveToResult(baseUrl + "/errors/notfound",
                new StringSource(content), new StringResult());
            Assert.fail("WebServiceTransportException expected");
        }
        catch (WebServiceTransportException ex) {
            //expected
        }
        try {
            template.sendSourceAndReceiveToResult(baseUrl + "/errors/server",
                new StringSource(content), result);
            Assert.fail("WebServiceTransportException expected");
        }
        catch (WebServiceTransportException ex) {
            //expected
        }
View Full Code Here

        new MethodParameter(getClass().getMethod("stax", StAXSource.class), -1)};
    }

    @Override
    protected Object getReturnValue(MethodParameter returnType) throws Exception {
        return new StringSource(XML);
    }
View Full Code Here

    public void testInvokeMimeMarshaller() throws Exception {
        MimeUnmarshaller unmarshaller = createMock(MimeUnmarshaller.class);
        MimeMarshaller marshaller = createMock(MimeMarshaller.class);
        MimeMessage request = createMock("request", MimeMessage.class);
        MimeMessage response = createMock("response", MimeMessage.class);
        Source requestSource = new StringSource("<request/>");
        expect(request.getPayloadSource()).andReturn(requestSource);
        expect(factoryMock.createWebServiceMessage()).andReturn(response);
        expect(unmarshaller.unmarshal(eq(requestSource), isA(MimeContainer.class))).andReturn(42L);
        Result responseResult = new StringResult();
        expect(response.getPayloadResult()).andReturn(responseResult);
View Full Code Here

    }

    @Test
    public void testNoResponse() throws Exception {
        endpoint = createNoResponseEndpoint();
        StringSource requestSource = new StringSource(REQUEST);
        Source resultSource = endpoint.invoke(requestSource);
        assertNull("Response source returned", resultSource);
    }
View Full Code Here

                return new TestContentHandler();
            }

            @Override
            protected Source getResponse(ContentHandler contentHandler) {
                return new StringSource(RESPONSE);
            }
        };
    }
View Full Code Here

    }

    @Test
    public void testNoResponse() throws Exception {
        endpoint = createNoResponseEndpoint();
        StringSource requestSource = new StringSource(REQUEST);

        MessageContext context =
                new DefaultMessageContext(new MockWebServiceMessage(requestSource), new MockWebServiceMessageFactory());
        endpoint.invoke(context);
        assertFalse("Response message created", context.hasResponse());
View Full Code Here

    @Test
    public void testSaajResponse() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        MessageFactory messageFactory = MessageFactory.newInstance();
        SaajSoapMessage request = new SaajSoapMessage(messageFactory.createMessage());
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        SaajSoapMessageFactory soapMessageFactory = new SaajSoapMessageFactory();
        soapMessageFactory.afterPropertiesSet();
        MessageContext context = new DefaultMessageContext(request, soapMessageFactory);

        MessageEndpoint endpoint = createResponseEndpoint();
View Full Code Here

    @Test
    public void testAxiomResponse() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.afterPropertiesSet();
        MessageContext context = new DefaultMessageContext(request, soapMessageFactory);

        MessageEndpoint endpoint = createResponseEndpoint();
View Full Code Here

    @Test
    public void testAxiomNoResponse() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.afterPropertiesSet();
        MessageContext context = new DefaultMessageContext(request, soapMessageFactory);

        MessageEndpoint endpoint = createNoResponseEndpoint();
View Full Code Here

TOP

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

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.