Now that you’ve installed GlassFish Tools Bundle for Eclipse 1.1, lets use this bundle to create a simple Metro/JAX-WS compliant Web service and deploy on GlassFish. These steps will work with either Eclipse 3.4.2 or 3.5 with WTP Java EE support.
- Lets create a simple “Dynamic Web Project” as shown below:
- Name the project “HelloMetro” and take all other defaults:

Click on “Finish” to complete the project creation.
- Metro allows to create a Web service from a POJO class. So let’s add a POJO to the project by right-clicking on the project and selecting “New”, “Class” as shown below:
Specify the package name as “server”, class name as “HelloService” and click on “Finish”.
- Add a simple method to the newly generated class as:
public String sayHello(String name) { return "Hello " + name + "!!"; } - Expand the project, go to “HelloService.java” in “server” package, right-click, select “Web Services”, “Create Web service”.
- Click on “Web service runtime: Apache Axis” and select “Metro (JAX-WS) Runtime” as the Web service runtime as shown below:

- Move the slider on the left to top. This will enable testing of the deployed Web service. The completed configuration looks like:

and click on “Next >”.
- Select the checkbox “Copy Metro library jars to the project” to resolve the references correctly as shown below:

and click on “Next >”. This bundles the application and deploys to GlassFish and provides an option to test the deployed Web service as shown below:

Clicking on the “Launch” button shows the following output in the browser:
The WSDL is hosted at “http://localhost:8083/HelloMetro/HelloServiceService?wsdl”.
- Click on “sayHello” method, click on “Add” and enter the value as “Duke” as shown below:

Click on “Go” and the response is shown as:

Clicking on “Source” in the response window shows the SOAP request/response messages as shown below:

- Alternatively, you can click on “Finish” to complete the dialog. Then click on “Run” menu item, “Launch the Web Services Explorer” to see a screen as:

Enter the URL of the WSDL in “WSDL URL” box as “http://localhost:8083/HelloMetro/HelloServiceService?wsdl” and click on “Go”. Now you are seeing the similar screen to test the Web service within the integrated browser as shown below:
A future blog will cover how to write a database-enabled application using the bundled Dali JPA Tools and MySQL pre-registered JDBC driver.
Please send your questions and comments to users@glassfishplugins.dev.java.net.
Please leave suggestions on other TOTD that you’d like to see. A complete archive of all the tips is available here.
Technorati: totd glassfish eclipse galileo webservices metro jax-ws
Related posts:- TOTD #99: Creating a Java EE 6 application using MySQL, JPA 2.0 and Servlet 3.0 with GlassFish Tools Bundle for Eclipse
- TOTD #19: How to Add Metro Quality-of-Service to Contract-First Endpoint ?
- Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 1
- Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 3
- TOTD #23: JavaFX Client invoking a Metro endpoint

I have a problem selecting the Web Service Runtime, Metro (JAX WS) Runtime doesn’t appear on the list of runtimes.
Only Axis and Axis2.
Why is that? I have installed metro on glassfish, and also the metro plugin verion 1.0.32.
Also I tried on different versions of Glassfish.
Thanks.
Comment by Leonardo — September 9, 2009 @ 7:41 am
Leonardo, What is your configuration:
- 3.4.2 + plugin
- 3.5 + plugin
- GlassFish Tools Bundle for Eclipse ?
Comment by Arun Gupta — September 14, 2009 @ 8:50 pm
I have the same issue, no matter what I have tried the METRO runtime never appears???
Comment by Peter — December 17, 2009 @ 3:55 am
Using eclipse 3.5; Java 6; Glassfish v3 on Ubuntu.
Comment by Peter — December 17, 2009 @ 3:57 am
Peter, can you post your question to users@glassfishplugins.dev.java.net ?
Comment by Arun Gupta — January 5, 2010 @ 4:03 pm
I recently posted this directly on the Eclipse WTP forum: http://www.eclipse.org/forums/index.php?t=msg&th=201000&start=0&S=0693cdfc809e2ea42f0eaabdf96e6305
I am attempting to find answers to an issue that sounds like it has already been raised with regard to getting the Metro JAX-WS runtime to show up as an option when using the latest Eclipse JEE release. Has anyone had any luck on this? This post has 305 views and no responses (other than my own followup). Is it basically that the Eclipse WTP will not support this at all?
Thanks
Comment by mark streit — December 4, 2010 @ 9:20 pm
I recently posted this directly on the Eclipse WTP forum: http://www.eclipse.org/forums/index.php?t=msg&th=201000&start=0&S=0693cdfc809e2ea42f0eaabdf96e6305
I am attempting to find answers to an issue that sounds like it has already been raised with regard to getting the Metro JAX-WS runtime to show up as an option when using the latest Eclipse JEE release. Has anyone had any luck on this? This post has 305 views and no responses (other than my own followup). Is it basically that the Eclipse WTP will not support this at all?
Thanks
Comment by mark streit — December 5, 2010 @ 6:29 am
Hi Arun,
I have completed all the step that you mentioned here but still Metro is not shown in Web service run time
Could you please help to setup metro in eclipse helios 3.6
Thanks
softashu@gmail.com
Comment by Ashutosh — May 3, 2011 @ 1:30 pm
hello
plaese help me
i want implement ecommerce with metro web services
Comment by sara a — August 5, 2011 @ 6:42 am
1. install GlassFish Tools Bundle for Eclipse
2. copy metro plugin from /dropins to your eclipse dropins
3. restart eclipse
Comment by michal — October 18, 2011 @ 5:38 am
[...] to add Metro web services support to Eclipse Indigo Arun Gupta has a nice tutorial where he can choose Metro from the web services runtimes list. I don’t have that option in [...]
Pingback by How to add Metro web services support to Eclipse Indigo | Software development support, software risk,bugs for bugs, risk analysis, — April 26, 2012 @ 5:02 pm
WOW just what I was looking for. Came here by searching for best website design companies
Comment by Bridgett — April 8, 2013 @ 5:50 am