Package org.springframework.ws

Examples of org.springframework.ws.WebServiceMessage


            this.messageContext = messageContext;
        }

        @Override
        public ResponseActions andExpect(ResponseMatcher responseMatcher) {
            WebServiceMessage request = messageContext.getRequest();
            WebServiceMessage response = messageContext.getResponse();
            if (response == null) {
                fail("No response received");
                return null;
            }
            try {
View Full Code Here


    @Test
    public void withPayloadSource() throws Exception {
        String payload = "<payload xmlns='http://springframework.org'/>";
        ResponseCreator responseCreator = ResponseCreators.withPayload(new StringSource(payload));

        WebServiceMessage response = responseCreator.createResponse(null, null, messageFactory);

        assertXMLEqual(payload, getPayloadAsString(response));

    }
View Full Code Here

    public void withPayloadResource() throws Exception {
        String payload = "<payload xmlns='http://springframework.org'/>";
        ResponseCreator responseCreator =
                ResponseCreators.withPayload(new ByteArrayResource(payload.getBytes("UTF-8")));

        WebServiceMessage response = responseCreator.createResponse(null, null, messageFactory);

        assertXMLEqual(payload, getPayloadAsString(response));
    }
View Full Code Here

    xmlBuilder.append("<soap:Header><header xmlns='http://springframework.org'/></soap:Header>");
    xmlBuilder.append("<soap:Body><payload xmlns='http://springframework.org'/></soap:Body>");
    xmlBuilder.append("</soap:Envelope>");
    String envelope = xmlBuilder.toString();
    ResponseCreator responseCreator = ResponseCreators.withSoapEnvelope(new StringSource(envelope));
        WebServiceMessage response = responseCreator.createResponse(null, null, messageFactory);
        assertXMLEqual(envelope, getSoapEnvelopeAsString((SoapMessage)response));
    }
View Full Code Here

    xmlBuilder.append("<soap:Header><header xmlns='http://springframework.org'/></soap:Header>");
    xmlBuilder.append("<soap:Body><payload xmlns='http://springframework.org'/></soap:Body>");
    xmlBuilder.append("</soap:Envelope>");
    String envelope = xmlBuilder.toString();
    ResponseCreator responseCreator = ResponseCreators.withSoapEnvelope(new ByteArrayResource(envelope.getBytes("UTF-8")));
        WebServiceMessage response = responseCreator.createResponse(null, null, messageFactory);
        assertXMLEqual(envelope, getSoapEnvelopeAsString((SoapMessage)response));
    }
View Full Code Here

    private static final URI GOOD_URI = URI.create("http://localhost");

    @Test
    public void match() {
      WebServiceMessage message = createMock(WebServiceMessage.class);
      expect(message.getPayloadSource()).andReturn(null);
      replay(message);
        UriMatcher matcher = new UriMatcher(GOOD_URI);
        matcher.match(GOOD_URI, message);
    }
View Full Code Here

        matcher.match(GOOD_URI, message);
    }

    @Test(expected = AssertionError.class)
    public void nonMatch() {
      WebServiceMessage message = createMock(WebServiceMessage.class);
      expect(message.getPayloadSource()).andReturn(null);
      replay(message);
        UriMatcher matcher = new UriMatcher(GOOD_URI);
        matcher.match(URI.create("http://www.example.org"), message);
    }
View Full Code Here

    public void existsMatch() throws IOException, AssertionError {
        XPathExpectationsHelper helper = new XPathExpectationsHelper("//b");
        WebServiceMessageMatcher matcher = helper.exists();
        assertNotNull(matcher);

        WebServiceMessage message = createMock(WebServiceMessage.class);
        expect(message.getPayloadSource()).andReturn(new StringSource("<a><b/></a>"));

        replay(message);

        matcher.match(message);
View Full Code Here

    public void existsNonMatch() throws IOException, AssertionError {
        XPathExpectationsHelper helper = new XPathExpectationsHelper("//c");
        WebServiceMessageMatcher matcher = helper.exists();
        assertNotNull(matcher);

        WebServiceMessage message = createMock(WebServiceMessage.class);
        expect(message.getPayloadSource()).andReturn(new StringSource("<a><b/></a>")).times(2);

        replay(message);

        matcher.match(message);
    }
View Full Code Here

    public void doesNotExistMatch() throws IOException, AssertionError {
        XPathExpectationsHelper helper = new XPathExpectationsHelper("//c");
        WebServiceMessageMatcher matcher = helper.doesNotExist();
        assertNotNull(matcher);

        WebServiceMessage message = createMock(WebServiceMessage.class);
        expect(message.getPayloadSource()).andReturn(new StringSource("<a><b/></a>"));

        replay(message);

        matcher.match(message);
View Full Code Here

TOP

Related Classes of org.springframework.ws.WebServiceMessage

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.