10-04-2017 09:02 AM
Hi All,
I had an HTTP VIs that use to work in LabVIEW. Recently, permissions changed on the APIs on the server that I was connecting to. The permissions has now been fix. But still my code does not work. I have used postman to send the same commands and they work fine. See my attached picture.
It shows error 400.
thanks
Jose
Solved! Go to Solution.
10-05-2017 10:19 AM
Can you provide a little more context into your application? A brief overview along with the following questions should be a good start.
Are you running this program as an executable?
Do you have any hardware interfacing with this application?
Can you post the full error message?
Do you have any firewalls that may be causing permission issues?
Can you provide an event log? It would help put some context on the error.
A 400 or 404 error is unlikely to be caused by the LabVIEW HTTP client and more probable on the windows or server side. This link has helped me in the past troubleshoot these kind of errors.
10-06-2017 09:39 AM
I think your problem may be something like I had a while back.
If you are using an https address, I think you need to specify a path to create a client-side cookie file in order to persist the secure connection info received from the server. Use "Generate Temporary File Path VI" to create a random file name in an OS specific standard location.
The temporary file does not get deleted when you close the session, so keep track of the file and delete it in your own code.
10-21-2017 12:41 AM
Hi Clint,
Sorry I haven't replied sooner, but I was working on another project.
To answer some of your questions. See below.
Are you running this program as an executable? No
Do you have any hardware interfacing with this application? Nope
Can you post the full error message? - The full error message is on the .png file I attached on my first post. See the "body".
Do you have any firewalls that may be causing permission issues? Not sure if firewalls are causing the issue. But would it also create an issue on postman?
Can you provide an event log? It would help put some context on the error. -- Not sure, I will check. My first response would be no.
10-21-2017 12:54 AM
Hi Phillip,
I tried your suggestion in adding a cookie. It did not work. Also, why would it work before without a cookie?
Please let me know if you have other suggestions.
Oh and yes, it is an https.
thanks,
Jose
10-23-2017 05:09 PM
Hi Jose,
As discussed on this page, the issue is likely on the client side or as a result or data corruption on the network. Does the data look fine from the server side in LabVIEW?
10-24-2017 10:24 AM - last edited on 11-06-2024 04:23 PM by Content Cleaner
Sorry, just saw your reply. Did your server change from http: to https:?
I didn't point out that I also added the ConfigSSL.vi call. http://zone.ni.com/reference/en-XX/help/371361N-01/lvcomm/http_client_configssl/
If your server changed from http to https, there are session variables that need to be persisted for libcurl. These aren't (to my knowledge) contained in the LabVIEW client handle, but do seem to be persisted in the temp file associated with the client handle. I tried using the ConfigSSL function without a temp file and I could not log into my DUT (host). Only the combination of a temp file and ConfigSSL allowed me to communicate with the DUT.
In my use case, I'm testing a newly booted UUT on a private network with no certificate requirements for security, so I change the Verify Server from the default of TRUE to FALSE.
Try the temp file with ConfigSSL.vi and set Verify Server to FALSE and see if that works.
10-24-2017 12:01 PM
Your 'headers' you are sending are malformed.
The 'add header' VI adds a key/value pair to the HTTP header. You are building the key value pairs yourself instead of letting the VI do them for you. You should call the 'add header' VI for each key/value header pair you want to send.
To do the authorisation, you just need to put 'Authorization' into the 'header' control and then your 'Basic **password**' as the value. That will add a line "Authorization: Basic **password" to the headers. The HTTP Client VI handles the other headers automatically itself (e.g. the timestamp).
You should check what is actually being received by the server (e.g. by checking server logs / logging the request / using a 3rd party checking service etc.).
10-25-2017 12:03 AM
FYI, your solution in separating headers to "Add Header vi" worked.
Now I am curious as to why it worked before and now I have to code it as you suggested?
thanks again!!
10-25-2017 12:04 AM
Thanks for the reply Philip. Sam's solution worked.