Package org.springframework.ws.transport

Examples of org.springframework.ws.transport.WebServiceConnection


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


    @Override
    public ModelAndView handle(HttpServletRequest httpServletRequest,
                               HttpServletResponse httpServletResponse,
                               Object handler) throws Exception {
        if (HttpTransportConstants.METHOD_POST.equals(httpServletRequest.getMethod())) {
            WebServiceConnection connection = new HttpServletConnection(httpServletRequest, httpServletResponse);
            try {
                handleConnection(connection, (WebServiceMessageReceiver) handler);
            }
            catch (InvalidXmlException ex) {
                handleInvalidXmlException(httpServletRequest, httpServletResponse, handler, ex);
View Full Code Here

        int port = FreePortScanner.getFreePort();
        Server jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        jettyContext.addServlet(new ServletHolder(new EchoServlet()), "/");
        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
            appContext.registerSingleton("messageSender", HttpComponentsMessageSender.class);
            appContext.refresh();

            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 {
            if (connection != null) {
                try {
                    connection.close();
                } catch (IOException ex) {
                    // ignore
                }
            }
            if (jettyServer.isRunning()) {
View Full Code Here

                                 WebServiceMessageCallback requestCallback,
                                 WebServiceMessageExtractor<T> responseExtractor) {
        Assert.notNull(responseExtractor, "'responseExtractor' must not be null");
        Assert.hasLength(uriString, "'uri' must not be empty");
        TransportContext previousTransportContext = TransportContextHolder.getTransportContext();
        WebServiceConnection connection = null;
        try {
            connection = createConnection(URI.create(uriString));
            TransportContextHolder.setTransportContext(new DefaultTransportContext(connection));
            MessageContext messageContext = new DefaultMessageContext(getMessageFactory());
View Full Code Here

        int port = FreePortScanner.getFreePort();
        Server jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        jettyContext.addServlet(new ServletHolder(new EchoServlet()), "/");
        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
            appContext.registerSingleton("messageSender", CommonsHttpMessageSender.class);
            appContext.refresh();

            CommonsHttpMessageSender messageSender = appContext
                    .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 {
                    connection.close();
                } catch (IOException ex) {
                    // ignore
                }
            }
            if (jettyServer.isRunning()) {
View Full Code Here

        public TcpRequestHandler(Socket socket) {
            this.socket = socket;
        }

        public void run() {
            WebServiceConnection connection = new TcpReceiverConnection(socket);
            try {
                handleConnection(connection);
            }
            catch (Exception ex) {
                logger.warn("Could not handle request", ex);
View Full Code Here

    protected WebServiceConnection createConnection(URI uri) throws IOException {
        Assert.notEmpty(getMessageSenders(), "Property 'messageSenders' is required");
        WebServiceMessageSender[] messageSenders = getMessageSenders();
        for (WebServiceMessageSender messageSender : messageSenders) {
            if (messageSender.supports(uri)) {
                WebServiceConnection connection = messageSender.createConnection(uri);
                if (logger.isDebugEnabled()) {
                    try {
                        logger.debug("Opening [" + connection + "] to [" + connection.getUri() + "]");
                    }
                    catch (URISyntaxException e) {
                        // ignore
                    }
                }
View Full Code Here

    }

    private String getUri() throws URISyntaxException {
        TransportContext transportContext = TransportContextHolder.getTransportContext();
        if (transportContext != null) {
            WebServiceConnection webServiceConnection = transportContext.getConnection();
            if (webServiceConnection != null) {
                return webServiceConnection.getUri().toString();
            }
        }
        return null;
    }
View Full Code Here

            this.configuration = configuration;
        }

        @Override
        public WebServiceConnection createConnection(URI uri) throws IOException {
            WebServiceConnection wsc = delegate.createConnection(uri);
            if (wsc instanceof HttpUrlConnection) {
                HttpURLConnection connection = ((HttpUrlConnection)wsc).getConnection();
               
                if (configuration.getTimeout() > -1) {
                    connection.setReadTimeout(configuration.getTimeout());
                }
               
                if (configuration.getSslContextParameters() != null && connection instanceof HttpsURLConnection) {
                    try {
                        synchronized (this) {
                            if (sslContext == null) {
                                sslContext = configuration.getSslContextParameters().createSSLContext();
                            }
                        }
                    } catch (GeneralSecurityException e) {
                        throw new RuntimeCamelException("Error creating SSLContext based on SSLContextParameters.", e);
                    }
                   
                    ((HttpsURLConnection) connection).setSSLSocketFactory(sslContext.getSocketFactory());
                }
            } else {
                throw new RuntimeCamelException("Unsupported delegate.  Delegate must return a org.springframework.ws.transport.http.HttpUrlConnection.  Found "
                        + wsc.getClass());
            }
           
            return wsc;
        }
View Full Code Here

    }

    private String getUri() throws URISyntaxException {
        TransportContext transportContext = TransportContextHolder.getTransportContext();
        if (transportContext != null) {
            WebServiceConnection webServiceConnection = transportContext.getConnection();
            if (webServiceConnection != null) {
                return webServiceConnection.getUri().toString();
            }
        }
        return null;
    }
View Full Code Here

TOP

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

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.