You are on page 1of 5

JAX-WS implementation in JBOSS:

1. created a dynamic project in eclipse HelloWorld

2. created our service class(my package is ws.simple)

3. Edited the web.xml as follows:

Added the entries below:

<servlet>
<servlet-name>HelloService</servlet-name>
<servlet-class>ws.simple.HelloService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloService</servlet-name>
<url-pattern>/service</url-pattern>
</servlet-mapping>
4. Exported as war file in jboss
Location for the wsdl file is :
C:\Users\jboss\jb\4.3.0\server\production\data\wsdl\HelloWorld.war\HelloService
Service7961998949159727873.wsdl

The wsdl file is as follows:


http://localhost:7001/HelloWorld/service?wsdl

5. Now, we consume this web service by creating client using utilities provided by
JBossWS stack ( Examples include wsconsume, wsget, wsrunclient etc )

C:\Users\jboss\jb\4.3.0\bin>wsconsume.bat -k
http://localhost:7001/HelloWorld/se
rvice?wsdl

Files are generated in the below location:


C:\Users\jboss\jb\4.3.0\bin\output\ws\simple
6. I have created a Sample Client Project and put these generated files in ws.simple

7. Created Client Class TestWSClient.java

package ws.simple;

public class TestWSClient


{
public static void main(String[] args)
{
HelloServiceService service =new HelloServiceService();
HelloService helloServ=service.getHelloServicePort();
String msg=helloServ.sayHello("Amit Das! Merry Christmas");
System.out.println(msg);
}
}

Running as java application generates as:


Hello, Amit Das! Merry Christmas

You might also like