After trying to make a call in Glasfish's WebService, the error below is occurring, I'm trying to make a call in Webservice Rest Json, in the so-called XML rest it runs normally.
package br.com.devmedia.ws.rest.example1;
import java.util.Random;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
@Path("ceprest")
public class CepRestWS {
@Context
private UriInfo context;
public CepRestWS() {
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("getCep/{cep}")
public Cep getCep(@PathParam("cep") String cep) {
Cep toReturn = new Cep();
toReturn.setCep(cep);
toReturn.setBairro("Bairro " + new Random().nextInt());
toReturn.setNumero(new Random().nextInt());
toReturn.setRua("Rua que sempre " + new Random().nextInt());
toReturn.setUf("PR");
return toReturn;
}
}