How to configure SSL in WSDL First CXF Framework web service?

5.4k views Asked by At

I am new to CXF framework. Recently successfully created webservices using CXF and Spring Endpoint. I am using WSDL first approach. Can you please suggest how to use SSL(https) for web services. I have idea about truststore and keystore. I am using Apache Tomcat server. below is my ApplicationContext.xml -->

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"
default-autowire="byName">

 <!-- Service endpoint -->
<jaxws:endpoint id="CalculatorWebService"
        implementorClass="com.web.calculator.service.CalculatorContractImpl"
        implementor="#CalculatorImpl"
        address="/CalculatorWS">
</jaxws:endpoint>

<bean id="CalculatorImpl" class="com.web.calculator.service.CalculatorContractImpl"/>

I believe I need to make some configuration entries for truststore here and similarly some configuration for keystore in client side in some xml. Also I think I need some Passwordcallback class for using keystores.

Can you please help me with the configurations that has to be made to enable SSL.

Your help is truly appreciated...

Thanks...

1

There are 1 answers

0
Paulius Matulionis On

Here is great tutorial how to set up everything you need with SSL in your CXF. Please refer to section Configuring SSL Support. And do not forget to enable https in your tomcat. The full "how to do this" is provided here. I assume that you did not try anything yet. All you need to do just follow these steps because there is everything explained very clear.