1) Create a HelloWorld.java service class in the src folder of the web application. The public methods of this class will be exposed as a web service.
package info.icontraining.ws;
public class HelloWorld
{
public String sayHello()
{
return "Hello World";
}
}
2) Create a HelloWorld.wsdd file in a local folder (not inside the application but anywhere on your hard disk, for example, C:\my-wsdd-files) to configure the web service and register with with the Apache Axis deployment
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="HelloWorld" provider="java:RPC">
<parameter name="className" value="info.icontraining.ws.HelloWorld"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
Note: Deploy the application to the Application Server at this time.
3) Register this web service by following the below steps,
a) Go to the "Run" menu in Eclipse and select the "Open Run Dialog..." option
b) In the Project, add the WebAppName; In the Main Class add: org.apache.axis.client.AdminClient
c) Click on the "Arguments" tab and in the Program Arguments, add the following:
-lhttp://localhost:8080/WebAppName/services/AdminService C:\path-to-wsdd-folder\HelloWorld.wsdd
Replace WebAppName and the path-to-wsdd-folder appropriately.
- The web service is registered if you see the output message:
Note: Re-starting of the JBoss Server will undo the registration of the web service.
4) To access the web service WSDL, invoke the following URL in the browser,
package info.icontraining.ws;
public class HelloWorld
{
public String sayHello()
{
return "Hello World";
}
}
2) Create a HelloWorld.wsdd file in a local folder (not inside the application but anywhere on your hard disk, for example, C:\my-wsdd-files) to configure the web service and register with with the Apache Axis deployment
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="HelloWorld" provider="java:RPC">
<parameter name="className" value="info.icontraining.ws.HelloWorld"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
Note: Deploy the application to the Application Server at this time.
3) Register this web service by following the below steps,
a) Go to the "Run" menu in Eclipse and select the "Open Run Dialog..." option
b) In the Project, add the WebAppName; In the Main Class add: org.apache.axis.client.AdminClient
c) Click on the "Arguments" tab and in the Program Arguments, add the following:
-lhttp://localhost:8080/WebAppName/services/AdminService C:\path-to-wsdd-folder\HelloWorld.wsdd
Replace WebAppName and the path-to-wsdd-folder appropriately.
- The web service is registered if you see the output message:
<Admin>Done Processing</Admin>
Note: Re-starting of the JBoss Server will undo the registration of the web service.
4) To access the web service WSDL, invoke the following URL in the browser,
http://localhost:8080/WebAppName/services/HelloWorld?wsdl
No comments:
Post a Comment