JBoss Community

Re: cxf.xml doesn't work under JBoss 6.1

created by Tao Sang in JBoss Web Services Development - View the full discussion

Hello Soldano, thanks a lot for your tipp! I solved the problem with the following line:

 

System.setProperty("org.jboss.security.ignoreHttpsHost", "true");

 

Another way to solve the problem is to use the JaxWsProxyFactoryBean method:

 

MyWebServiceEndpoint port = null;

 

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
//factory.getInInterceptors().add(new LoggingInInterceptor()); //Print feedback soap message
//factory.getOutInterceptors().add(new LoggingOutInterceptor()); //Print output soap message
factory.setServiceClass(MyWebServiceEndpoint.class);
factory.setAddress(_mbean.getMyWebServiceURL());
port = (MyWebServiceEndpoint) factory.create();
configHttpConduit(port);

 

BindingProvider bp = (BindingProvider)port;

bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);

bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);

...

 

 

private void configHttpConduit(Object service) {

        Client clientProxy = ClientProxy.getClient(service);

 

        HTTPConduit conduit = (HTTPConduit) clientProxy.getConduit();

        String targetAddr = conduit.getTarget().getAddress().getValue();

        if (targetAddr.toLowerCase().startsWith("https:")) {

            TrustManager[] simpleTrustManager = new TrustManager[] { new X509TrustManager() {

                public java.security.cert.X509Certificate[] getAcceptedIssuers() {

                    return null;

                }

 

                public void checkClientTrusted(

                        java.security.cert.X509Certificate[] certs, String authType) {

                }

 

                public void checkServerTrusted(

                        java.security.cert.X509Certificate[] certs, String authType) {

                }

            } };

            TLSClientParameters tlsParams = new TLSClientParameters();

            tlsParams.setTrustManagers(simpleTrustManager);

            tlsParams.setDisableCNCheck(true);

            tlsParams.setSecureSocketProtocol("SSL"); // This line is not very necessary.

            conduit.setTlsClientParameters(tlsParams);

 

        }

    }

Reply to this message by going to Community

Start a new discussion in JBoss Web Services Development at Community