How to create WebService in JBoss AS7 using eclipse.

JBoss Application Server 7.1 comes bundled with JBossWS component. This component is based on Apache CXF. So those people who know Apache CXF, you will love JBoss AS.

First of all, you need to have few basic requirements:

JDK 1.7 (JDK 1.6 is sufficient, but using newest one is recommended)

eclipse indigo (Java EE developer) from

JBoss AS7

JBoss Tools:

You cannot immediately start developing applications for JBoss AS7. You need to get Plugins for your eclipse.

Open eclipse –> Help –> Install new software

add following URL :

now expand “JBoss Web and JavaEE development”

select following components:

  • JBossAS Tools
  • JBoss WebServices Tools
  • Hibernate Tools
  • JBoss JAX-RS Tools

Now, install all these components.

Once installation in complete, you need to restart eclipse.

Now, add JBoss AS7 as WebServer to your eclipse workspace.

Now, click finish to add JBossAS7 to your eclipse workspace.

Create new Dynamic Web Project:

now, click on “Modify” button to change configuration, select “JBoss Web Services Core”

Click OK –> next –> Generate Web.xml = true –> Next


Select “Server Supplied JBossWS runtime”

click Finish.

Create new class: Calculator


NOTE: This step can be safely SKIPPED!

Create new WebService:

click on WebService Runtime: Apache Axix (in configuration section above) select JBossWS

Click OK


Click Next

Select both option –> Next

Click on “Start Server” –> Wait for Server startup –> Next –> Finish

Now, right click on your project name (My project name is “MyServiceApp1” –>Run as –> Run on Server

change URL in web-browser to include your service name eg. http://localhost:8080/MyServiceApp1/Calculator?wsdl

(Please change port no and application name if they are different)

I you get to see wsdl for newly created web services then you are done!

You can now test this web service using eclipse:

goto Run menu –> Lauch web services explorer


click on “WSDL page” button in top-right  corner


Once you click on “Go” button, you will be presented a page where you can test this Service


now, click on link to method “sum”

enter two value and click go..


It’s done….


5 comments on “How to create WebService in JBoss AS7 using eclipse.

  1. Its really nice man. Keep it up. I tried with jboss 7.1.1 which has CXF 2.4.6 by default which throwed…” Failed to define class org.apache.cxf.wsn.jms.JmsPublisher in Module”…So i replaced my CXF library at Eclipse Juno ->Windows -> Preferences -> Webservices – CXF2.x preferences to reflect CXF 2.2.5 from 2.7.0 (which throwed error as above in jboss 7). Then it went through like breeze. Excellent tutorial. All the best. 🙂

  2. I had a hard time finding a simple example of what should be really straightforward. This worked perfectly for me (with the secret step being to download and set up the JBoss plugins). Seems like there are some problems with the images loading, though.

  3. hi it’s really good example..i have tried this example when i entered input arguments it’s gives IWAB0135E An unexpected error has occurred.504 Gateway Time-out ..please help me to find solution…..

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s