Library Link To Toggle Frames Print Feedback

Deploying a Celtix Endpoint

Deployment steps

The following steps outline, at a high-level, what you must do to successfully deploy a Celtix endpoint to the Celtix Spring container:

  1. Write one or more bean definition files to configure your application. See Writing bean definition files .

  2. Build a WAR file that contains your bean definition file(s), the WSDL file that defines your service, and the code that you generated from that WSDL file, including the implementation file, and any libraries that your application needs. See Building a WAR file .

  3. Deploy the WAR file in one of three ways:

    1. Copy the WAR file to the Spring container repository. See Deploying WAR file to the Spring repository .

    2. Using the JMX console. See Managing the Container using the JMX Console .

    3. Using the Web service interface. See Managing the Container using the Web Service Interface .

Writing bean definition files

You must write one or more bean definition files in XML to configure your application. They must define the beans that make up your application and any dependencies the beans have on each other. The Celtix Spring container needs these files to instantiate, configure and assemble the beans in your application. Example 1.1, “Bean Definition File—spring.xml” shows the bean definition file used in the Spring container sample application. It is called spring.xml. You can, however, use any name for your file(s) as long as it ends with a .xml extension.

Example 1.1. Bean Definition File—spring.xml

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
1   <bean id="TestApplication" class="com.iona.cxf.container.ApplicationBean">
       <property name="services">
           <list>
               <ref bean="SOAPService" />
           </list>
       </property>
   </bean>

2   <bean id="SOAPService" class="com.iona.cxf.container.ServiceBean">
       <property name="serviceImpl">
           <ref bean="SOAPServiceImpl" />
       </property>
        <property name="wsdlLocation" value="hello_world.wsdl"
/>
       <property name="endpoints">
           <list>
               <ref bean="SoapPort" />
           </list>
       </property>
   </bean>

3   <bean id="SoapPort" class="com.iona.cxf.container.EndpointBean">
       <property name="portName" value="{http://apache.org/hello_world_soap_http}SoapPort"
/>
       <property name="address"  value="http://localhost:9000/SoapContext/SoapPort"
/>
   </bean>

4   <bean id="SOAPServiceImpl" class="demo.hw.server.GreeterImpl"/>
</beans>

The code shown in Example 1.1, “Bean Definition File—spring.xml” can be explained as follows:

  1. Configures a TestApplication bean of type ApplicationBean. Applications that deploy an endpoint to the Spring container must define a bean of the ApplicationBean type. ApplicationBean has one property—services—which specifies the service that is being deployed as part of the application. In this example, the SOAPService bean is referenced and it is defined next in the XML file (see 2 below).

    Note that the name of the application is taken from the name of the WAR file.

  2. Configures a SOAPService bean of type ServiceBean, which defines a service and its corresponding endpoints. Although in this example the bean ID is same as the service name, the ID can be any name you want to specify. ServiceBean has three properties:

    1. serviceImpl—sets the implementation object used by all of the service endpoints; in this case, the SOAPServiceImpl bean is referenced and it is defined later in the XML file (see 4 below.

    2. wsdlLocation—sets the location of the WSDL document which contains the service definition; in this case the hello_world.wsdl file located in the InstallDir/samples/spring_container/hello_world/wsdl directory.

    3. endpoints—sets the service endpoints; in this case, the SoapPort bean is referenced and it is defined next in the XML file (see 3 below.

  3. Configures a SoapPort bean of type EndpointBean, which specifies the port on which the service will run. EndpointBean has two properties:

    1. portName—specifies the name and the namespace of port used to define the endpoint. The value for both of these is taken from the WSDL file that defines the service that is being deployed. In this example, the values shown are taken from the hello_world.wsdl file. See the targetNamespace element and the wsdl:service element in that file.

    2. address—specifies the address of the endpoint as defined in the WSDL file that defines service that is being deployed; in this case, http://localhost:9000/SoapContext/SoapPort (see the wsdl:service element in the hello_world.wsdl file).

  4. Identifies the class that implements the service.

Building a WAR file

In order to deploy your application to the Spring container you must build a WAR file that has the following structure and contents:

  1. META-INF/spring should include your bean definition file(s). Your bean definition file(s) must have a .xml extension.

  2. WEB-INF/classes should include your Web service implementation class and any other classes (including the class hierarchy) generated by the Celtix wsdl2java utility.

  3. WEB-INF/wsdl should include the WSDL file that defines the service that you are deploying.

  4. WEB-INF/lib should include any JARs required by your application.

Deploying WAR file to the Spring repository

The simplest way to deploy the Celtix endpoint to the Spring container is to:

  1. Start the Spring container by running the following command from the InstallDir/bin directory:

    spring_container start

  2. Copy the WAR file to the Spring container repository. The default location for the repository is:

    InstallDir/containers/spring_container/repository

The Spring container automatically scans the repository for newly deployed applications.

Changing the interval at which the Spring container scans its repository

You can change the time interval at which the Spring container scans the repository by changing the scanInterval property in the spring_container.xml configuration file. The default value is 1000 milliseconds. See Example 1.2, “spring_container.xml” for more detail.

Changing the default location of the container repository

You can change the Spring container repository location by changing the value of the containerRepository property in the spring_container.xml configuration file. See Example 1.2, “spring_container.xml” for more detail.