Package org.springframework.ws.transport

Examples of org.springframework.ws.transport.FaultAwareWebServiceConnection


        MyServlet servlet = new MyServlet();
        servlet.setResponseStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        servlet.setResponse(true);
        jettyContext.addServlet(new ServletHolder(servlet), "/");
        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


    }

    private void validateResponse(Servlet servlet) throws Exception {
        jettyContext.addServlet(new ServletHolder(servlet), "/");
        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

            if (messageContext.hasResponse()) {
                WebServiceMessage response = messageContext.getResponse();
                if (response instanceof FaultAwareWebServiceMessage &&
                        connection instanceof FaultAwareWebServiceConnection) {
                    FaultAwareWebServiceMessage faultResponse = (FaultAwareWebServiceMessage) response;
                    FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
                    faultConnection.setFaultCode(faultResponse.getFaultCode());
                }
                connection.send(messageContext.getResponse());
            }
        }
        catch (NoEndpointFoundException ex) {
View Full Code Here

     */
    protected boolean hasError(WebServiceConnection connection, WebServiceMessage request) throws IOException {
        if (checkConnectionForError && connection.hasError()) {
            // could be a fault
            if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection) {
                FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
                return !(faultConnection.hasFault() && request instanceof FaultAwareWebServiceMessage);
            }
            else {
                return true;
            }
        }
View Full Code Here

     * @throws IOException in case of I/O errors
     */
    protected boolean hasFault(WebServiceConnection connection, WebServiceMessage response) throws IOException {
        if (checkConnectionForFault && connection instanceof FaultAwareWebServiceConnection) {
            // check whether the connection has a fault (i.e. status code 500 in HTTP)
            FaultAwareWebServiceConnection faultConnection = (FaultAwareWebServiceConnection) connection;
            if (!faultConnection.hasFault()) {
                return false;
            }
        }
        if (response instanceof FaultAwareWebServiceMessage) {
            // either the connection has a fault, or checkConnectionForFault is false: let's verify the fault
View Full Code Here

TOP

Related Classes of org.springframework.ws.transport.FaultAwareWebServiceConnection

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.