Package org.springframework.ws.soap.saaj

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


    @Test(expected = AssertionError.class)
    public void nonMatch() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage saajMessage = messageFactory.createMessage();
        SoapMessage soapMessage = new SaajSoapMessage(saajMessage);

        matcher.match(soapMessage);
    }
View Full Code Here


    @Test(expected = AssertionError.class)
    public void noPayload() throws Exception {
        PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource("<message/>"));
        MessageFactory messageFactory = MessageFactory.newInstance();
        SoapMessage soapMessage = new SaajSoapMessage(messageFactory.createMessage());

        matcher.createDiff(soapMessage);
    }
View Full Code Here

        jettyServer.start();
        FaultAwareWebServiceConnection connection =
                (FaultAwareWebServiceConnection) messageSender.createConnection(connectionUri);
        SOAPMessage request = createRequest();
        try {
            connection.send(new SaajSoapMessage(request));
            connection.receive(messageFactory);
            Assert.assertTrue("Response has no fault", connection.hasFault());
        }
        finally {
            connection.close();
View Full Code Here

        jettyServer.start();
        FaultAwareWebServiceConnection connection =
                (FaultAwareWebServiceConnection) messageSender.createConnection(connectionUri);
        SOAPMessage request = createRequest();
        try {
            connection.send(new SaajSoapMessage(request));
            SaajSoapMessage response = (SaajSoapMessage) connection.receive(messageFactory);
            Assert.assertNotNull("No response", response);
            Assert.assertFalse("Response has fault", connection.hasFault());
            SOAPMessage saajResponse = response.getSaajMessage();
            String[] headerValues = saajResponse.getMimeHeaders().getHeader(RESPONSE_HEADER_NAME);
            Assert.assertNotNull("Response has no header", headerValues);
            Assert.assertEquals("Response has invalid header", 1, headerValues.length);
            Assert.assertEquals("Response has invalid header values", RESPONSE_HEADER_VALUE, headerValues[0]);
            StringResult result = new StringResult();
            Transformer transformer = transformerFactory.newTransformer();
            transformer.transform(response.getPayloadSource(), result);
            assertXMLEqual("Invalid response", RESPONSE, result.toString());
        }
        finally {
            connection.close();
        }
View Full Code Here

        jettyServer.start();

        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

            HttpComponentsMessageSender messageSender = appContext
                    .getBean("messageSender", HttpComponentsMessageSender.class);
            connection = messageSender.createConnection(new URI("http://localhost:" + port));

            connection.send(new SaajSoapMessage(messageFactory.createMessage()));
            connection.receive(new SaajSoapMessageFactory(messageFactory));

            appContext.close();
        }
        finally {
View Full Code Here

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

    @Override
    protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext)
            throws XwsSecuritySecurementException {
        Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " +
                "Use a SaajSoapMessageFactory to create the SOAP messages.");
        SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage;
        try {
            ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage());
            SOAPMessage result = processor.secureOutboundMessage(context);
            saajSoapMessage.setSaajMessage(result);
        }
        catch (XWSSecurityException ex) {
            throw new XwsSecuritySecurementException(ex.getMessage(), ex);
        }
        catch (WssSoapFaultException ex) {
View Full Code Here

    @Override
    protected void validateMessage(SoapMessage soapMessage, MessageContext messageContext)
            throws WsSecurityValidationException {
        Assert.isTrue(soapMessage instanceof SaajSoapMessage, "XwsSecurityInterceptor requires a SaajSoapMessage. " +
                "Use a SaajSoapMessageFactory to create the SOAP messages.");
        SaajSoapMessage saajSoapMessage = (SaajSoapMessage) soapMessage;
        try {
            ProcessingContext context = processor.createProcessingContext(saajSoapMessage.getSaajMessage());
            SOAPMessage result = processor.verifyInboundMessage(context);
            saajSoapMessage.setSaajMessage(result);
        }
        catch (XWSSecurityException ex) {
            throw new XwsSecurityValidationException(ex.getMessage(), ex);
        }
        catch (WssSoapFaultException ex) {
View Full Code Here

                    .getBean("messageSender", CommonsHttpMessageSender.class);
            connection = messageSender.createConnection(new URI("http://localhost:" + port));

            appContext.close();

            connection.send(new SaajSoapMessage(messageFactory.createMessage()));
            connection.receive(new SaajSoapMessageFactory(messageFactory));
        }
        finally {
            if (connection != null) {
                try {
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.