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

Re: How to Test if the URL is valid from RPG



Hi Ashish,

HTTPAPI does not currently support the HEAD method...

You could add support for the HEAD method, or you could use a GET instead...



Ashish Kulkarni wrote:
>    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");
>     }
> 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------