cancel
Showing results for 
Search instead for 
Did you mean: 

How do I check whether a given URL is a valid URL or not.

Former Member
0 Kudos

Dear colleagues,

in a 6.20 system I would like to check user input in an URL field. I would like to check if the given input is a valid URL.

I'm looking for an ABAP function modul call or an ABAP method with an importing parameter for the URL and return either a variable or exception in case the URL is not a valid one.

Example for what I'm looking for is:

If the user enters : 'http://www.wetteronline.de' is to be a valid URL

there the user enters as URL 'http://www.wttonl.de' results in an HTTP 500 Error and therefore would return from the function modul or method, that it is an invalid URL.

Any suggestion how to program this check are welcome.

Best regards and thanks

hans-Ludwig

Accepted Solutions (1)

Accepted Solutions (1)

athavanraja
Active Contributor
0 Kudos

what you could do use cl_http_client class and send a dummy http request to the site to see whether its available or not.

check out the following program for sample code

RSWF_TEST_HTTP

Regards

Raja

Former Member
0 Kudos

Hi Raja,

thank you for the hint to the report RSWF_TEST_HTTP:

I checked it out. Unfortunetaly I got in both cases (valid and invalid URL) the same answer from the report:

HTTP-Receive: RC=400 ICM_HTTP_CONNECTION_FAILED

So I do not have here a differentiation to distinct the two types of URL.

Is there another option, or do you know how to customize the system, that it would give in the case of the correct URL NOT an error message?

(I checked the report in 3 systems (6.20, 6.40, 6.40).

Thanks and regards Hans-Ludwig

athavanraja
Active Contributor
0 Kudos

do you connect to internet via proxy server? can you check the valid url in browser to see whether you are able to access them

if you connecting to internet thru proxy server, then you have to mainting proxy server/authentication details from transaction SICF->client->proxy settings.

Message was edited by:

Durairaj Athavan Raja

Former Member
0 Kudos

If I enter in the browser: http://www.wetteronline.de

I get the expected result, and it works fine.

If I enter the same URL (cut and paste) into the input field of the report I get the error message.

athavanraja
Active Contributor
0 Kudos

you didnt answer my other question about proxy. i checked in my system (6.40) and its working as expected

Former Member
0 Kudos

Which system is that is it SAP internal. If yes what is the SID, since I'm SAP internal.

Former Member
0 Kudos

and there might be proxy's but if so, what has to be done then?

athavanraja
Active Contributor
0 Kudos

i am not SAP internal.

proxy

if you connecting to internet thru proxy server, then you have to mainting proxy server/authentication details from transaction SICF->client->proxy settings.

Former Member
0 Kudos

I checked the proxy settings by SICF GOTO->HTTP client proxy settings. There is nothing maintained, neither for HTTP, nor HTTPS. Could that be the issue?

Is there something maintained in your system?

athavanraja
Active Contributor
0 Kudos

as i said before this required only if you are connecting to internet via proxy and the url you are trying to reach is on internet.

SICF GOTO->HTTP client proxy settings

in global settings tab

check the check box "proxy setting is active"

and in the "HTTP log" tab

enter proxy host name e.g proxy.sap.com....

enter the proxy server port (generally 80)

if required you need to enter

proxy server authentication (uid/pwd)

Regards

Raja

athavanraja
Active Contributor
0 Kudos

while accessing any internet address from your browser, do you get a pop up for authentication?

Former Member
0 Kudos

Hi Raja,

it took me some time to figure out what our proxy server and proxy port are. But now I've found it.

I configured the HTTP client proxy settings accordingly and now it works!!!!

Many thanks for your support.

Best regards

Hans-Ludwig

Answers (0)