WSO2 Web Services Framework/Spring - Installation Guide
Mandatory
For the Binary Distribution- Spring and Spring Weaver .jars relevant to your servlet
container should be in your classpath (WEB-INF/lib directory)
For the Source Distribution JDK 1.5 and Maven 2 is required to build the source.
Deploying a Web Service using WSF/Spring
Building
with the binary distribution
The following instrutions will be relative your webapp present in the
servlet container's webapps directory.- Copy the jars in the WEB-INF/lib directory to your classpath (WEB-INF/lib directory in a web application)
- Insert the following entries in your web.xml
-
Add the following line in your application context (WEB-INF/ in this case) and copy the axisConfig.xml to the relevant location
<import resource="axis2Config.xml"/>
-
Declare a service bean and add your Spring beans to expose them as web services.
- To include WS-Security,
<bean id="services" class="org.wso2.spring.ws.WebServices">
NOTE: policyFileName.xml and key file(keyFileName.jks) should be put in WEB-INF/classes of your web application
<property name="services">
<list>
<bean id="bookService" class="org.wso2.spring.ws.SpringWebService">
<property name="serviceBean" ref="secureProductManager"></property>
<property name="serviceName" value="SecureTestProductManager"></property>
<property name="modules">
<list>
<value>rampart</value>
</list>
</property>
<property name="policyFiles">
<list>
<value>policyFileName.xml</value>
<list>
<property>
</bean>
</list>
</property>
</bean> - See the WSDL of your service by targeting your browser to http://{host}: {port}/ {webapp}/services/ {serviceName} ? wsdl
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<!--Point to the application context of the application -->
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>axis2</servlet-name>
<servlet-class>
org.wso2.spring.ws.servlet.SpringAxis2Servlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>axis2</servlet-name>
<url-pattern>/axis2/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>axis2</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
Ex :- If you have a Spring
bean with the ID "productManager", it can be exposed as follows:
<bean id="services" class="org.wso2.spring.ws.WebServices">
<property name="services">
<list>
<bean id="bookService" class="org.wso2.spring.ws.SpringWebService">
<property name="serviceBean" ref="productManager"></property>
<property name="serviceName" value="TestProductManager"></property>
</bean>
</list>
</property>
</bean>
Building the Source Distribution
- Type
mvn clean install� in the base directory (where the source was downloaded to). - If, the build fails due to a missing artifact build again by typing
mvn clean install -up - A .war file will be created at BASEDIR/modules/webapp/target/ (An exploded version of the .war file will be located at the same location).
- Drop the .war file into a servlet container (ex:- Apache-Tomcat 5.5)