WSF/Spring (Web Services Framework for Spring)

WSO2 recently released WSF/Spring. A web services framework for Spring.

So what’s so special about WSF/Spring? Does anyone get the feeling that its already out there? Is it the same old thing all over again? Take a look closer maybe it’s not the same old thing.Let’s clear it out by taking a look at what’s out there.

  1. Doesn’t web service engines like Axis2 have Spring
    integrated already?

Exactly. Spring is already integrated into these engines. But here’s the catch. Spring is integrated into Axis2. Not the other way around. No Inversion of Control here. It’s done in a “non-Spring” manner. The web service engine is in control.

WSF/Spring changes this around and puts the Spring user in control. It integrates Axis2 into Spring. A Spring user can actually expose one of his beans without any knowledge of Axis2!

  1. What about Spring Web Services? Web Services done in the Spring manner. Surely, this has to address the above problem.

It does address the problem. Allows the suer to expose web services in that “Spring”
manner. Here’s the difference. It’s contract-first. And yes, it’s an excellent method to use. But use it a while and you’ll find out that it’s a bit too complex for a simple web service. A simple Hello World! will involve a considerable amount of work. WSF/Spring follows the code-first approach and with just a few entries in your
application Context, your Spring bean is ready to be consumed as a web
service.

Let me illustrate. Say you have a bean with id “productManager” and you want to make it a (surprise, surprise!) web service. After the initial web.xml configuration (documented in the INSTALL file, a simple copy and paste activity) here’s all you have to enter in your application context.

<import resource=”axis2Config.xml”/>

<bean id=”services” class=”org.wso2.spring.ws.WebServices”>
<property name=”services”>
<list>
<bean id=”managerService” class=”org.wso2.spring.ws.SpringWebService”>
<property name=”serviceBean” ref=”productManager”></property>
<property name=”serviceName” value=”TestProductManager”>
</property>
</bean>
</list>
</property>
</bean>

That’s it!!! and you have a web service that exposes the “productManger” bean.

The axis2Config.xml that is imported here is given to you in the framework.
That’s the neat other feature. You can actually change the Axis2 start up parameters, and that too in the Spring way.

Here’s a snippet of the axis2Config.xml :

<bean id=”axisConfig” class=”org.wso2.spring.ws.SpringAxisConfiguration”>
<property name=”parameters”>
<list>
<bean id=”hd”
class=”org.wso2.spring.ws.beans.ParameterBean”>
<property name=”name”
value=”hotdeployment”></property>
<property name=”value”
value=”true”></property>
</bean>

Just like defining a Spring bean, now you can control how the Axis2
engine behaves.

WSF/Spring inherits the power of Axis2 as it uses the Axis2 web engine. This means that some of WS-* implementations that Spring Web Services have not implemented yet, such as WS-SecureConversation, WS-Trust, etc. is already implemented by WSF/Spring.

Still a child in making, WSF/Spring is yet to prove its worth in the industry. But at a glance, it seems to make life much easier for the web service savvy Spring user.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s