Package org.springframework.ws.soap.saaj

Examples of org.springframework.ws.soap.saaj.SaajSoapMessage


        MimeHeaders mimeHeaders = new MimeHeaders();
        mimeHeaders.addHeader("Content-Type", " application/soap+xml");
        InputStream is = getClass().getResourceAsStream("valid.xml");
        assertNotNull("Could not load valid.xml", is);
        try {
            SaajSoapMessage message = new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, is));
            return new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));
        }
        finally {
            is.close();
        }
View Full Code Here


    @Test
    public void testResolveExceptionReceiverSoap12() throws Exception {
        MessageFactory saajFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPMessage message = saajFactory.createMessage();
        SoapMessageFactory factory = new SaajSoapMessageFactory(saajFactory);
        MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);

        boolean result = resolver.resolveException(context, null, new MyReceiverException());
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
View Full Code Here

        this.messageSource.setBasename("org.springframework.ws.soap.server.endpoint.messages");
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage request = messageFactory.createMessage();
        request.getSOAPBody().addBodyElement(new QName("http://www.springframework.org/spring-ws", "request"));
        messageContext =
                new DefaultMessageContext(new SaajSoapMessage(request), new SaajSoapMessageFactory(messageFactory));
    }
View Full Code Here

        mapping.afterPropertiesSet();
    }

    @Test
    public void testMatch() throws Exception {
        SaajSoapMessage message = loadSaajMessage("200408/valid.xml");
        MessageContext messageContext = new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));

        EndpointInvocationChain endpoint = mapping.getEndpoint(messageContext);
        assertNotNull("No endpoint returned", endpoint);
        assertEquals("Invalid endpoint returned", endpoint1, endpoint.getEndpoint());
View Full Code Here

        assertTrue("Invalid first interceptor", interceptors[2] instanceof PayloadValidatingInterceptor);
    }

    @Test
    public void testNoMatch() throws Exception {
        SaajSoapMessage message = loadSaajMessage("200408/response-no-message-id.xml");
        MessageContext messageContext = new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));

        EndpointInvocationChain endpoint = mapping.getEndpoint(messageContext);
        assertNull("Endpoint returned", endpoint);
    }
View Full Code Here

    protected String getTestPath() {
        return "10";
    }

    public void testNoTo() throws Exception {
        SaajSoapMessage valid = loadSaajMessage(getTestPath() + "/request-no-to.xml");
        MessageContext context = new DefaultMessageContext(valid, new SaajSoapMessageFactory(messageFactory));
        URI messageId = new URI("uid:1234");
        expect(strategyMock.newMessageId((SoapMessage) context.getResponse())).andReturn(messageId);
        replay(strategyMock);
        boolean result = interceptor.handleResponse(context, null);
        assertTrue("Request with no To not handled", result);
        assertTrue("Message Context has no response", context.hasResponse());
        SaajSoapMessage expectedResponse = loadSaajMessage(getTestPath() + "/response-anonymous.xml");
        assertXMLEqual("Invalid response for message with invalid MAP", expectedResponse,
                (SaajSoapMessage) context.getResponse());
        verify(strategyMock);
    }
View Full Code Here

            interceptor.setSchema(new ClassPathResource(SCHEMA2, PayloadValidatingInterceptorTest.class));
            interceptor.afterPropertiesSet();
            MessageFactory messageFactory = MessageFactory.newInstance();
            SOAPMessage saajMessage =
                    SaajUtils.loadMessage(new ClassPathResource(VALID_SOAP_MESSAGE, getClass()), messageFactory);
            context = new DefaultMessageContext(new SaajSoapMessage(saajMessage),
                    new SaajSoapMessageFactory(messageFactory));

            boolean result = interceptor.handleRequest(context);
            Assert.assertTrue("Invalid response from interceptor", result);
            Assert.assertFalse("Response set", context.hasResponse());
View Full Code Here

        resolver.setExceptionMappings(mappings);

        MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPMessage message = messageFactory.createMessage();
        SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
        MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);

        boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
View Full Code Here

        resolver.setExceptionMappings(mappings);

        MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPMessage message = messageFactory.createMessage();
        SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
        MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);

        boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
View Full Code Here

        resolver.setExceptionMappings(mappings);

        MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPMessage message = messageFactory.createMessage();
        SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
        MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);

        boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
        Assert.assertTrue("resolveException returns false", result);
        Assert.assertTrue("Context has no response", context.hasResponse());
        SoapMessage response = (SoapMessage) context.getResponse();
View Full Code Here

TOP

Related Classes of org.springframework.ws.soap.saaj.SaajSoapMessage

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.