Arquivo para julho \31\-03:00 2013

Straight to the point: Simple Axis2 Hello World WebService

It’s the simplest possible Web Service (that I’m aware of) you can make. I will not explain the details, only the steps.

  1. Download AXIS2, unzip, and start it by executing: bin/axis2server.sh;
  2. Create the following folder structure “helloservice/META-INF”;
  3. Create the file “helloservice/HelloService.java” and place inside the folling code:public class HelloService
    {
        public String sayHello(){
            return “Hello World!!!”;
        }
    }
  4. Compile the class by calling “javac HelloService.java”;
  5. Create the file “helloservice/META-INF/services.xml” and place inside the folling code:
    <service>
        <parameter name=”ServiceClass” locked=”false”>HelloService</parameter>
           <operation name=”sayHello”>
           <messageReceiver class=”org.apache.axis2.rpc.receivers.RPCMessageReceiver”/>
        </operation>
    </service>
  6. Move/copy the folder “helloservice” to inside the Axis2 folder “[AXIS_HOME]/repository/services”;
  7. Axis2 will deploy it giving the message “Deploying Web service: helloservice”
  8. Try it by requesting the url: http://localhost:8080/axis2/services/helloservice?wsdl or just http://localhost:8080/axis2/services/helloservice;

 

Note: SoapUI version bug (creating new project)

If when you try to create a new project on SoapUI you get the following message(stacktrace):

Caused by: org.apache.xmlbeans.XmlException: error: Reference to undefined entity: atilde…

The problem probablly is the version of SoapUI you are using. I got that on 3 .6, now with 4.5.2 the problem is gone.