Comment publier le service Web Rest "Hello world"?


package my.first.rest;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("hello")
public class Hello {

  // This method is called if TEXT_PLAIN is requested
  @GET
  @Produces(MediaType.TEXT_PLAIN)
  public String sayHelloInPlainText() {       
    return "Hello world!";
  }
 http://stackoverflow.com/questions/2893796/create-hello-world-with-restful-web-service-and-jersey
  // This method is called if HTML is requested
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String sayHelloInHtml() {
    return "<html> " + "<title>" + "Hello world!" + "</title>"
        + "<body><h1>" + "Hello world!" + "</body></h1>" + "</html> ";
  }
}

C'est mon code que j'ai écrit service Web Restful. Lorsque je publie avec le Client de test, cette erreur arrive:

IWAB0489E Error when deploying Web service to Axis runtime
  axis-admin failed with  {http://schemas.xmlsoap.org/soap/envelope/}
  Server.userException java.net.ConnectException: Connection refused: connect

Comment vais-je le réparer? Cela vient avec le repos seulement, pas avec du SAVON.

Author: Andrew Thompson, 2014-01-14

1 answers

Vous devez télécharger le jersey [implémentation de REST de sunmicrosystem] et inclure ces jars dans votre application en dehors de cela, vous devez modifier votre web.xml en conséquence.
Il existe plusieurs didacticiels pour débutants disponibles sur net - cliquez ici

 0
Author: Naveen Ramawat, 2014-01-14 08:07:39