Package org.springframework.ws

Examples of org.springframework.ws.WebServiceMessage


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

    @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


        Assert.assertTrue("void method not supported", adapter.supports(endpoint));
    }

    @Test
    public void testInvokeTypes() throws Exception {
        WebServiceMessage messageMock = createMock(WebServiceMessage.class);
        expect(messageMock.getPayloadSource()).andReturn(new StringSource(CONTENTS));
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);
        replay(messageMock, factoryMock);

        MessageContext messageContext = new DefaultMessageContext(messageMock, factoryMock);
        MethodEndpoint endpoint = new MethodEndpoint(this, "supportedTypes",
View Full Code Here

        verify(messageMock, factoryMock);
    }

    @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

        Element second = document.createElementNS(rootNamespace, "other-child");
        rootElement.appendChild(second);
        text = document.createTextNode("other-value");
        second.appendChild(text);

        WebServiceMessage requestMock = createMock(WebServiceMessage.class);
        expect(requestMock.getPayloadSource()).andReturn(new DOMSource(first));
        WebServiceMessageFactory factoryMock = createMock(WebServiceMessageFactory.class);

        replay(requestMock, factoryMock);

        Map<String, String> namespaces = new HashMap<String, String>();
View Full Code Here

            eventWriter.setPrefix(prefix, uri);
        }

        private void createEventWriter() throws XMLStreamException {
            if (eventWriter == null) {
                WebServiceMessage response = messageContext.getResponse();
                eventWriter = getEventWriter(response.getPayloadResult());
                if (eventWriter == null) {
                    // as a final resort, use a stream, and transform that at endDocument()
                    os = new ByteArrayOutputStream();
                    eventWriter = getOutputFactory().createXMLEventWriter(os);
                }
View Full Code Here

     *
     * <p>This implementation delegates to {@link #shouldIntercept(WebServiceMessage, Object)}.
     */
    @Override
    public boolean shouldIntercept(MessageContext messageContext, Object endpoint) {
        WebServiceMessage request = messageContext.getRequest();
        return request != null && shouldIntercept(request, endpoint);
    }
View Full Code Here

     * @see #setRequestXslt(org.springframework.core.io.Resource)
     */
    @Override
    public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {
        if (requestTemplates != null) {
            WebServiceMessage request = messageContext.getRequest();
            Transformer transformer = requestTemplates.newTransformer();
            transformMessage(request, transformer);
            logger.debug("Request message transformed");
        }
        return true;
View Full Code Here

     * @see #setResponseXslt(org.springframework.core.io.Resource)
     */
    @Override
    public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception {
        if (responseTemplates != null) {
            WebServiceMessage response = messageContext.getResponse();
            Transformer transformer = responseTemplates.newTransformer();
            transformMessage(response, transformer);
            logger.debug("Response message transformed");
        }
        return true;
View Full Code Here

    /** Returns the local part of the payload root element of the request. */
    @Override
    protected String getLookupKeyForMessage(MessageContext messageContext)
            throws TransformerException {
        WebServiceMessage request = messageContext.getRequest();
        QName rootQName = PayloadRootUtils.getPayloadRootQName(request.getPayloadSource(), transformerFactory);
        return rootQName.getLocalPart();
    }
View Full Code Here

        afterMarshallerSet();
    }

    @Override
    public final void invoke(MessageContext messageContext) throws Exception {
        WebServiceMessage request = messageContext.getRequest();
        Object requestObject = unmarshalRequest(request);
        if (onUnmarshalRequest(messageContext, requestObject)) {
            Object responseObject = invokeInternal(requestObject);
            if (responseObject != null) {
                WebServiceMessage response = messageContext.getResponse();
                marshalResponse(responseObject, response);
                onMarshalResponse(messageContext, requestObject, responseObject);
            }
        }
    }
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.