CharlesAnthony
Posts: 18
Joined: Wed Oct 07, 2009 9:45 am

SendCollectedData : Http Return Code

Hi,

I'm now succesfully sending data to a web application via the SendCollectedData custom action. I can see that the http reponse text is stored in the HttpPostServerResponse.

Is it possible, though, to find out the http response code? Or, indeed, if the URL could not be accessed at all? The latter is especially important...

Cheers,

Charles.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SendCollectedData : Http Return Code

Hi Charles,
Is it possible, though, to find out the http response code? Or, indeed, if the URL could not be accessed at all?
I'm not sure I understand what you mean. The server response is placed in the "HttpPostServerResponse" installer property. Since your script (on your server) issues the response, it can be anything you want: a message, a code, both etc. During install you can verify the value in this property to determine if the server responded, with what message etc.

For example, your script response can be:

Code: Select all

connected successfully
or

Code: Select all

200
or

Code: Select all

200|connected successfully
Since it's a text message it can be anything you want and you can parse it anyway you need to obtain the response information.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
CharlesAnthony
Posts: 18
Joined: Wed Oct 07, 2009 9:45 am

Re: SendCollectedData : Http Return Code

Hi Cosmin,

I'm not sure I understand what you mean.
Sorry, I wasn't terribly clear or explicit - end of the working day!

When I said "http server response code", I should have been more specific - the HTTP Status Code, which is returned as an HTTP Header as part of the reponse stream, as defined in RFC2616 which (defines the HTTP/1.1 Protocol) - specifically Section 6.1.1

In other words, the 404 error that I'm sure we're all familiar with when we visit a web link that no longer exists - here's a simple list of HTTP Status Codes

I was planning to use that HTTP Status code to control the flow of part of the installer (e.g. if I received a 401 code "Unauthorized", I'd stop the installer; if I received a 404, I'd display an error dialog), as it seems to give me exactly what I need without re-implementing a status line in the text of the response.

I imagine from your response, then, that this is not implemented in AI - I'll just have to (re) implement my own protocol in the response text itself.

Importantly, though, how can I tell if the HTTP post was successful at all? What if I posted to a host (web server) that doesn't exist , or that couldn't be accessed due to network errors - is any error code set?


Best Wishes,

Charles.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: SendCollectedData : Http Return Code

Hi Charles,

Currently we do not offer this support. However I have added this functionality on our TODO list, and will be implemented in a future version of Advanced Installer.
In the meantime you can only tell if the request was successful by testing the HttpPostServerResponse property with a condition like this

Code: Select all

HttpPostServerResponse <> ""
It is important that you test if it is empty. Using the following condition would be incorrect, as it tests for the property's existence, and not for its contents:

Code: Select all

NOT HttpPostServerResponse
Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
CharlesAnthony
Posts: 18
Joined: Wed Oct 07, 2009 9:45 am

Re: SendCollectedData : Http Return Code

Thanks Gabriel.
rileydog
Posts: 17
Joined: Fri Jul 27, 2007 2:00 am

Re: SendCollectedData : Http Return Code

Hi Cosmin,

I have a related question, so i will add it here.

1) I am using (http://www.advancedinstaller.com/user-g ... -info.html) to get started collecting data. I have two question about this file:
a) after adding an event, I can't find anyway to delete it. Can you help?
b) With one exception, I have successfully created the setup shown in the screen shot and the end of the file. The exception is that I can add the last Event in 'Published Event'. I can certainly add a 'NewDialog" Event; however, the Argument shown (ServerResponse), is not available in the listed related to "NewDialog". What am I doing wrong.

2) I know the data are being sent to my server as I use Wireshark to capture the data. I want to do the above to be able to improve my installer.

Thanks for the help
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: SendCollectedData : Http Return Code

Hello,

You can right-click the event and click remove, or you can click the "Remove" button to remove the event.
The ServerResponse dialog is actually the dialog that follows your dialog sequence. You do not need to recreate this particular event, you will have another NewDialog in its place.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: SendCollectedData : Http Return Code

Hello,

This was fixed in version 14.2 of Advanced Installer released on July 26th, 2017.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”