简体   繁体   中英

How 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 this list, and so I can't make Metro web services with the wizard:

Web服务运行时

I have already installed Oracle GlassFish Server Tools. Has anybody done this? If yes, how? Please if you have some best practices or suggestions feel free to share!

EDIT I found the instructions about how to correctly install the GlassFish plugin, but the update site https://ajax.dev.java.net/eclipse is dead.

Reinstalled the plugin as presented here , but no success.

Look over this

http://www.myeclipseide.com/documentation/quickstarts/webservices_jaxws/

This is jax-ws metro lib, you don't need to have GlassFish. Tomcat will do.

They added Metro JAX-WS run-time libraries.

I have tried this, and it works.

For Eclipse Indigo.

Create Java project

import javax.jws.WebService;
@WebService
public class WSResponse {
    public String getMessage(String name){
    return "Hello "+name;
    }
}
//Create build.xml
<project default="wsgen">
<target name="wsgen" >
<exec executable="wsgen">
<arg line="-cp ./bin -keep -s ./src -d ./bin com.ws.service.example.WSResponse"/>
</exec>
</target>
</project>

Execute Ant build.xml file

Finally Write: WS-publishing class

import javax.xml.ws.Endpoint;
public class RunWSService {
public static void main(String[] args) {
    System.out.println("Startring Web Service started.");
    Endpoint.publish("http://localhost:8080/WSExample", new WSResponse());
}
}

Test it with Web Service Explorer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM