Package org.springframework.ws

Examples of org.springframework.ws.WebServiceMessage


    public void testValidateCertificateWithSignatureConfirmation() throws Exception {
        SoapMessage message = loadSoap11Message("signed-soap.xml");
        MessageContext messageContext = getSoap11MessageContext(message);
        interceptor.setEnableSignatureConfirmation(true);
        interceptor.validateMessage(message, messageContext);
        WebServiceMessage response = messageContext.getResponse();
        interceptor.secureMessage(message, messageContext);
        assertNotNull("No result returned", response);
        Document document = getDocument((SoapMessage) response);
        assertXpathExists("Absent SignatureConfirmation element",
                "/SOAP-ENV:Envelope/SOAP-ENV:Header/wsse:Security/wsse11:SignatureConfirmation", document);
View Full Code Here


public class PayloadDiffMatcherTest {

    @Test
    public void match() throws Exception {
        String xml = "<element xmlns='http://example.com'/>";
        WebServiceMessage message = createMock(WebServiceMessage.class);
        expect(message.getPayloadSource()).andReturn(new StringSource(xml)).times(2);
        replay(message);

        PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource(xml));
        matcher.match(message);
View Full Code Here

    }

    @Test(expected = AssertionError.class)
    public void nonMatch() throws Exception {
        String actual = "<element1 xmlns='http://example.com'/>";
        WebServiceMessage message = createMock(WebServiceMessage.class);
        expect(message.getPayloadSource()).andReturn(new StringSource(actual)).times(2);
        replay(message);

        String expected = "<element2 xmlns='http://example.com'/>";
        PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource(expected));
        matcher.match(message);
View Full Code Here

        WebServiceConnection connection = messageSender.createConnection(connectionUri);
        SOAPMessage request = createRequest();
        try {
            connection.send(new SaajSoapMessage(request));
            WebServiceMessage response = connection.receive(messageFactory);
            Assert.assertNull("Response", response);
        }
        finally {
            connection.close();
        }
View Full Code Here

        logUri(connection);
        TransportContext previousTransportContext = TransportContextHolder.getTransportContext();
        TransportContextHolder.setTransportContext(new DefaultTransportContext(connection));

        try {
            WebServiceMessage request = connection.receive(getMessageFactory());
            MessageContext messageContext = new DefaultMessageContext(request, getMessageFactory());
            receiver.receive(messageContext);
            if (messageContext.hasResponse()) {
                WebServiceMessage response = messageContext.getResponse();
                if (response instanceof FaultAwareWebServiceMessage &&
                        connection instanceof FaultAwareWebServiceConnection) {
                    FaultAwareWebServiceMessage faultResponse = (FaultAwareWebServiceMessage) response;
                    FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
                    faultConnection.setFaultCode(faultResponse.getFaultCode());
View Full Code Here

                sendRequest(connection, messageContext.getRequest());
                if (hasError(connection, messageContext.getRequest())) {
                    triggerAfterCompletion(interceptorIndex, messageContext, null);
                    return (T) handleError(connection, messageContext.getRequest());
                }
                WebServiceMessage response = connection.receive(getMessageFactory());
                messageContext.setResponse(response);
            }
            logResponse(messageContext);
            if (messageContext.hasResponse()) {
                if (!hasFault(connection, messageContext.getResponse())) {
View Full Code Here

        Assert.assertEquals("Invalid request returned", request, context.getRequest());
    }

    @Test
    public void testResponse() throws Exception {
        WebServiceMessage response = new MockWebServiceMessage();
        expect(factoryMock.createWebServiceMessage()).andReturn(response);
        replay(factoryMock);

        WebServiceMessage result = context.getResponse();
        Assert.assertEquals("Invalid response returned", response, result);
        verify(factoryMock);
    }
View Full Code Here

        onReceiveBeforeRead();
        tis = createTransportInputStream();
        if (tis == null) {
            return null;
        }
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        onReceiveAfterRead(message);
        return message;
    }
View Full Code Here

public class MarshallingUtilsTest {

    @Test
    public void testUnmarshal() throws Exception {
        Unmarshaller unmarshallerMock = createMock(Unmarshaller.class);
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);

        Source source = new StringSource("");
        Object unmarshalled = new Object();
        expect(messageMock.getPayloadSource()).andReturn(source);
        expect(unmarshallerMock.unmarshal(source)).andReturn(unmarshalled);

        replay(unmarshallerMock, messageMock);

        Object result = MarshallingUtils.unmarshal(unmarshallerMock, messageMock);
View Full Code Here

    }

    @Test
    public void testMarshal() throws Exception {
        Marshaller marshallerMock = createMock(Marshaller.class);
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);

        Result result = new StringResult();
        Object marshalled = new Object();
        expect(messageMock.getPayloadResult()).andReturn(result);
        marshallerMock.marshal(marshalled, result);

        replay(marshallerMock, messageMock);

        MarshallingUtils.marshal(marshallerMock, marshalled, messageMock);
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.