lundi 31 juillet 2017

Connection time out error using java webservices

I am getting connection time out error and some time javax.ws.rs.ProcessingException: Unable to invoke request while sending data to the server database using web services. How could i solve this error, bellow is the my code please help me solve this issue..Thanks & appreciated in advanced...

inputStream = Olis.class.getClassLoader().getResourceAsStream(propFileName);
         try {
              prop.load(inputStream);
          } catch (IOException e) {
              e.printStackTrace();
          }
        String docitURL = prop.getProperty("docit.url");
        String docitAuthToken = prop.getProperty("docit.authToken");
        if (extracted(inputStream) != null) {
            prop.load(extracted(inputStream));
        } else {
            throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
        }

        String tempURL = docitURL + "token=" + docitAuthToken;


        System.out.println("url: "+tempURL);
        Client client = ClientBuilder.newClient();
        Response response = client.target(tempURL).request(MediaType.APPLICATION_JSON)
                .post(Entity.entity(lr, MediaType.APPLICATION_JSON), Response.class);

        if (response.getStatus() == Status.CREATED.getStatusCode() || response.getStatus() == Status.NO_CONTENT.getStatusCode())
            return true;
        else
            return false;




Aucun commentaire:

Enregistrer un commentaire