Package org.springframework.ws

Examples of org.springframework.ws.WebServiceMessage


    public void invoke(MessageContext messageContext, Object endpoint) throws Exception {
        PayloadEndpoint payloadEndpoint = (PayloadEndpoint) endpoint;
        Source requestSource = messageContext.getRequest().getPayloadSource();
        Source responseSource = payloadEndpoint.invoke(requestSource);
        if (responseSource != null) {
            WebServiceMessage response = messageContext.getResponse();
            transform(responseSource, response.getPayloadResult());
        }
    }
View Full Code Here


        Assert.notNull(clazz, "'clazz' must not be null");
        Assert.notNull(jaxbElement, "'jaxbElement' must not be null");
        if (logger.isDebugEnabled()) {
            logger.debug("Marshalling [" + jaxbElement + "] to response payload");
        }
        WebServiceMessage response = messageContext.getResponse();
        if (response instanceof StreamingWebServiceMessage) {
            StreamingWebServiceMessage streamingResponse = (StreamingWebServiceMessage) response;

            StreamingPayload payload = new JaxbStreamingPayload(clazz, jaxbElement);
            streamingResponse.setStreamingPayload(payload);
        }
        else {
            Result responsePayload = response.getPayloadResult();
            try {
                Jaxb2ResultCallback callback = new Jaxb2ResultCallback(clazz, jaxbElement);
                TraxUtils.doWithResult(responsePayload, callback);
            }
            catch (Exception ex) {
View Full Code Here

            throw convertToJaxbException(ex);
        }
    }

    private Source getRequestPayload(MessageContext messageContext) {
        WebServiceMessage request = messageContext.getRequest();
        return request != null ? request.getPayloadSource() : null;
    }
View Full Code Here

        return requestPayload != null ? resolveRequestPayloadArgument(parameter, requestPayload) : null;
    }

    /** Returns the request payload as {@code Source}. */
    private Source getRequestPayload(MessageContext messageContext) {
        WebServiceMessage request = messageContext.getRequest();
        return request != null ? request.getPayloadSource() : null;
    }
View Full Code Here

    public final void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
            throws Exception {
        if (returnValue != null) {
            Source responsePayload = createResponsePayload(returnType, returnValue);
            if (responsePayload != null) {
                WebServiceMessage response = messageContext.getResponse();
                transform(responsePayload, response.getPayloadResult());
            }
        }
    }
View Full Code Here

    @Override
    public Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception {
        Unmarshaller unmarshaller = getUnmarshaller();
        Assert.state(unmarshaller != null, "unmarshaller must not be null");

        WebServiceMessage request = messageContext.getRequest();
        Object argument = MarshallingUtils.unmarshal(unmarshaller, request);
        if (logger.isDebugEnabled()) {
            logger.debug("Unmarshalled payload request to [" + argument + "]");
        }
        return argument;
View Full Code Here

        Assert.state(marshaller != null, "marshaller must not be null");

        if (logger.isDebugEnabled()) {
            logger.debug("Marshalling [" + returnValue + "] to response payload");
        }
        WebServiceMessage response = messageContext.getResponse();
        MarshallingUtils.marshal(marshaller, returnValue, response);
    }
View Full Code Here

        Assert.assertTrue("Method not invoked", noResponseInvoked);
    }

    @Test
    public void testResponse() throws Exception {
        WebServiceMessage request = new MockWebServiceMessage("<request/>");
        messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
        MethodEndpoint methodEndpoint = new MethodEndpoint(this, "response", new Class[]{StreamSource.class});
        Assert.assertFalse("Method invoked", responseInvoked);
        adapter.invoke(messageContext, methodEndpoint);
        Assert.assertTrue("Method not invoked", responseInvoked);
View Full Code Here

        adapter.afterPropertiesSet();
    }

    @Test
    public void testNoResponse() throws Exception {
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);
        expect(messageMock.getPayloadSource()).andReturn(new StringSource("<request/>"));
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);
        MessageContext messageContext = new DefaultMessageContext(messageMock, factoryMock);

        Method noResponse = getClass().getMethod("noResponse", MyGenericType.class);
        MethodEndpoint methodEndpoint = new MethodEndpoint(this, noResponse);
View Full Code Here

        verify(marshallerMock, unmarshallerMock, messageMock, factoryMock);
    }

    @Test
    public void testNoRequestPayload() throws Exception {
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);
        expect(messageMock.getPayloadSource()).andReturn(null);
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);
        MessageContext messageContext = new DefaultMessageContext(messageMock, factoryMock);

        Method noResponse = getClass().getMethod("noResponse", MyGenericType.class);
        MethodEndpoint methodEndpoint = new MethodEndpoint(this, noResponse);
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.