[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to Test if the URL is valid from RPG



   Hi

   I have a RPG program to call a web service and use HttpAPI to do so, i
   need to find out if the Webservice URL is valid and if the web service
   is working.

   In java i would dom, is there a way i can do this from RPG?

   String urlEndPoint = "[1]http://www.yahoo.com";;

   HttpURLConnection.setFollowRedirects(false);
     HttpURLConnection con =  (HttpURLConnection) new
   URL(urlEndPoint).openConnection();
     con.setRequestMethod("HEAD");
     boolean flag = (con.getResponseCode() == HttpURLConnection.HTTP_OK);
     if(!flag)
     {

   System.out.println("Webservice is not valid or not working");
    }

References

   1. http://www.yahoo.com/
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------