#1 2012-12-17 14:12:13

paulh
Member
Registered: 2012-05-12
Posts: 44

Browser call to verify connectivity

Hi Arnaud, we have a site that is failing to connect to our server at Amazon using our client app.
It will be a permissions issue on their side because it is working fine from other user sites. However what I used to do when I had my own web service was to send a message back to browsers to show that they had successfully made contact with the web service even though the normal calls from the client application required the agent to be set correctly in HTTP calls and the packets were encrypted.
Is there a call that our users can make using a browser on the machines that they are trying to run our software to enable them see when it is able to successfully connect to the web service?
The way that our server is instantiated is as follows in case the test varies by object setup type:

    aServer := TSQLRestServerFullMemory.Create(aModel,jsonStr,false,true);
    try
      try
        aServer.ServiceRegister(TServiceERefServer,[TypeInfo(IERefServerInterface)],sicShared).ContractExpected := EREFER_CONTRACT;
        aHTTPServer := TSQLite3HttpServer.Create(COMMS_PORT,[aServer]);

Please advise what URL to use in a browser to allow us test connectivity? Let me know if anything I need to implement or turn on at the server side to make this work?

Regards

Paul

Offline

#2 2012-12-17 17:16:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Browser call to verify connectivity

Interface-based services requires the authentication to be running.
So you would need to "sign" the URI, with some secure, but complex algorithm - see http://blog.synopse.info/post/2011/05/2 … entication

I suppose that the easiest in your case is to compute a "ping" service using not interface-based services, but method-based services.
See http://blog.synopse.info/post/2010/07/1 … phi-7-2010

Offline

#3 2012-12-17 17:48:00

paulh
Member
Registered: 2012-05-12
Posts: 44

Re: Browser call to verify connectivity

Hi Arnaud, I did debug the code and found the URI it was using: http://myservername.uk.com/root/ERefServerInterface

I found that I would get the following message displayed in the browser when you use this base URL and have connectivity to the server:

{
"ErrorCode":403,
"ErrorText":"Forbidden"
}

So I have told the user site's IT people to use that URI to test connectivity.

However, it would be great if they could do something like: http://myservername.uk.com/root/ERefSer … estConnect
and I displayed a message like:

"Welcome to eRefer web service - this confirms that your PC has connectivity to allow the eRefer application to run successfully."

Is there a way to override the default "{ "ErrorCode":403 ..." error message or implement a function that bypasses authentication for pinging?

Thanks

Paul

Offline

#4 2012-12-17 18:54:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Browser call to verify connectivity

If you have such an error message, it means that the server is available.
403 means that server did receive and handle the request, but the URI was not authorized.
It could be enough to test the server availability.

Why just not use a method-based service for pinging?
You just need to call TSQLRestServer.ServiceMethodByPassAuthentication() in order to notify that authentication is not needed for this method name.

Offline

Board footer

Powered by FluxBB