Package org.springframework.ws

Examples of org.springframework.ws.WebServiceMessage


    @Test
    public void testSendAndReceiveResultNoResponsePayload() throws Exception {
        connectionMock.send(isA(WebServiceMessage.class));
        expect(connectionMock.hasError()).andReturn(false);
        WebServiceMessage response = createMock(WebServiceMessage.class);
        expect(connectionMock.receive(messageFactory)).andReturn(response);
        expect(connectionMock.hasFault()).andReturn(false);
        expect(response.getPayloadSource()).andReturn(null);
        connectionMock.close();

        replay(connectionMock, response);

        StringResult result = new StringResult();
View Full Code Here


        interceptor.setSchema(new ClassPathResource("codexws.xsd", getClass()));
        interceptor.afterPropertiesSet();

        Resource resource = new ClassPathResource("axiom.xml", getClass());
        TransportInputStream tis = new MockTransportInputStream(resource.getInputStream());
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        MessageContext context = new DefaultMessageContext(message, messageFactory);
        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid response from interceptor", result);

    }
View Full Code Here

        interceptor.setSchema(new ClassPathResource("multipleNamespaces.xsd", getClass()));
        interceptor.afterPropertiesSet();

        Resource resource = new ClassPathResource("multipleNamespaces.xml", getClass());
        TransportInputStream tis = new MockTransportInputStream(resource.getInputStream());
        WebServiceMessage message = messageFactory.createWebServiceMessage(tis);
        MessageContext context = new DefaultMessageContext(message, messageFactory);
        boolean result = interceptor.handleRequest(context, null);
        Assert.assertTrue("Invalid response from interceptor", result);

    }
View Full Code Here

            processor.supportsReturnType(rootElementReturnType));
    }

    @Test
    public void resolveArgumentRootElement() throws JAXBException {
        WebServiceMessage request = new MockWebServiceMessage("<root xmlns='http://springframework.org'><string>Foo</string></root>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        Object result = processor.resolveArgument(messageContext, rootElementParameter);
        assertTrue("result not a MyRootElement", result instanceof MyRootElement);
        MyRootElement rootElement = (MyRootElement) result;
View Full Code Here

        assertEquals("invalid result", "Foo", rootElement.getString());
    }

    @Test
    public void resolveArgumentType() throws JAXBException {
        WebServiceMessage request = new MockWebServiceMessage("<type xmlns='http://springframework.org'><string>Foo</string></type>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        Object result = processor.resolveArgument(messageContext, typeParameter);
        assertTrue("result not a MyType", result instanceof MyType);
        MyType type = (MyType) result;
View Full Code Here

            }
        };
        final SAXSource source = new SAXSource(xmlReader, new InputSource());
       
        // Create a mock WebServiceMessage that returns the SAXSource as payload source.
        WebServiceMessage request = new WebServiceMessage() {
            @Override
            public void writeTo(OutputStream outputStream) throws IOException {
                throw new UnsupportedOperationException();
            }
           
View Full Code Here

                processor.supportsReturnType(supportedReturnType));
    }

    @Test
    public void resolveArgument() throws JAXBException {
        WebServiceMessage request = new MockWebServiceMessage("<myType xmlns='http://springframework.org'><string>Foo</string></myType>");
        MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());

        JAXBElement<?> result = processor.resolveArgument(messageContext, supportedParameter);
        assertTrue("result not a MyType", result.getValue() instanceof MyType);
        MyType type = (MyType) result.getValue();
View Full Code Here

    protected void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
        Source requestSource = messageContext.getRequest().getPayloadSource();
        Object result = methodEndpoint.invoke(requestSource);
        if (result != null) {
            Source responseSource = (Source) result;
            WebServiceMessage response = messageContext.getResponse();
            transform(responseSource, response.getPayloadResult());
        }
    }
View Full Code Here

        Assert.notNull(getUnmarshaller(), "unmarshaller is required");
    }

    @Override
    protected void invokeInternal(MessageContext messageContext, MethodEndpoint methodEndpoint) throws Exception {
        WebServiceMessage request = messageContext.getRequest();
        Object requestObject = unmarshalRequest(request);
        Object responseObject = methodEndpoint.invoke(new Object[]{requestObject});
        if (responseObject != null) {
            WebServiceMessage response = messageContext.getResponse();
            marshalResponse(responseObject, response);
        }
    }
View Full Code Here

        Element payloadElement = getRootElement(messageContext.getRequest().getPayloadSource());
        Object[] args = getMethodArguments(payloadElement, methodEndpoint.getMethod());
        Object result = methodEndpoint.invoke(args);
        if (result != null && result instanceof Source) {
            Source responseSource = (Source) result;
            WebServiceMessage response = messageContext.getResponse();
            transform(responseSource, response.getPayloadResult());
        }
    }
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.