Hi all,

As part of my current project, I need to expose a Spring Bean as a Web
Service. (I'm new to Web Services.) We're using Axis2 1.5.1.
The project is built with maven2 and produces a war. We want the Web Service
to be part of the Webapp (we do not want to deploy the Axis2 webapp and use
an aar).

I've read the POJO Guide here:
http://ws.apache.org/axis2/1_5_1/pojoguide.html
and the Spring Guide here:
http://ws.apache.org/axis2/1_5_1/spring.html
This page:
http://wso2.org/library/90
also helped me on how to embed an Axis2 Web Service in our webapp.

Good news is that I got something working. But it's not fully working and
there are still a few things not clear to me:

First, I haven't written a WSDL file. Only a services.xml. But when I reach
the URL:
http://domain/services/myService?wsdl
...I do get a WSDL. So I guess it's generated by Axis2 based on the
services.xml and on the bean itself. My first question is: is it a good way
to go? Or should I write a WSDL?


My second question is about the parameters we can or cannot use in web
services:

The interface of the bean exposed as a web service looks like:

public interface MyService
{
    String getName(String name);
    MyObject createMyObject(Map<String, String> properties)
    MyObject updateMyObject(MyObject object, Map<String, String>
newProperties);
    MyObject removeMyObject(MyObject object);
}

and the MyObject class is:

public class MyObject
{
    public enum Status {
      Success,
      Error,
      Invalid
    }

  private Status status;
  private long id;
  private String field1;
  private String field2;

  // + getters and setters for each field
}

With my Web Service client (which uses an RPCServiceClient), I can call the
String getName(String name) method successfully, but not the other ones.
I have 2 problems with the other methods:
First, they are using Map<String, String> as parameters. I read a lot of
posts about that and it seems using java specific classes in web services is
not a good thing since web services are supposed to be platform/language
independent.
But I know for sure that my project will be 100% Java, so I'd like to use
Maps anyway. And since the posts I read were quite old, I was wondering if
there is now an easy way to do that? Maybe using JiBX ? Would it be
compatible with a POJO/Spring web service?

Second, I have a problem with the serialization of the MyObject class: I get
an error related to the status field. The error says something like "Status
type has no constructor...." Anyone know about that?

Last thing, I'll have to make this web service secure. Is Rampart the way I
should go? Can I integrate it with a POJO/Spring web service?

Any help would be much appreciated!
Thank you,
Phil.

Reply via email to