LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Response to AJAX HTTP Request with LabVIEW

Solved!
Go to solution

Dear reader, 

 

I'm trying to have Labview request data from an ajax call 

 

So, labview request data from a web service, the web service respond and I get the data in labVIEW ! As simple as that ! 

 

However, even using https://forums.ni.com/t5/Example-Code/Response-to-AJAX-HTTP-Request-with-LabVIEW/ta-p/3527887?profil... i'm having trouble using it...

 

on the getlogin.html, I changed the url to have the request of what I want ; When open the file, I click on "get login", boom, I have in the console the data I want ! WIN ! 

So, now I would like to have that response in LabVIEW ! 

FYI, the answer from the ajax request is JSON, so I should be able to "explode" it in LabVIEW no problem (As long as I got it there !)

 

In labview, the error I got is -67301 : 

Possible reason(s):

LabVIEW: (Hex 0xFFFEF91B) LabVIEW Web Services: Invalid Request ID.


Complete call chain:
NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi
NI_WebServices.lvlib:Web Request.lvclass:Set HTTP Response MIME Type.vi
Index.vi

 

Probably something stupid, but any help is appreciated ! 

 

Thank you ! 

 

 

0 Kudos
Message 1 of 8
(218 Views)

If you attached a VI, it would help show us what you are doing.

 

Without it, we can only guess.  My first thought is that you need something in the header of the HTTP request.

0 Kudos
Message 2 of 8
(214 Views)

I literraly use the one from the example here : https://forums.ni.com/t5/Example-Code/Response-to-AJAX-HTTP-Request-with-LabVIEW/ta-p/3527887?profil... ; Except the url ; I changed it to something internal to our network

Except for that, exactly the same ! 

 

 

0 Kudos
Message 3 of 8
(202 Views)

Howdy ! 

 

Here is the code I'm trying to execute ; 

It does a simple ajax call to  a test server and get a data ; 

The HTML works and populate the box ; I would like to have the value of that box in labview ! 

 

Do you think this is possible ? 

 

Thank you for all your help ! 

 

Benoit

0 Kudos
Message 4 of 8
(161 Views)

Please attach a true zip file and not a .7z file.

 

No reason to make others install 3rd part programs when Windows natively handles zip files

0 Kudos
Message 5 of 8
(155 Views)

My bad...

 

see attached

0 Kudos
Message 6 of 8
(150 Views)
Solution
Accepted by topic author BenDur

following this solution, I solved my problem ! 

 

https://forums.ni.com/t5/LabVIEW-Web-Development/xmlhttprequest-from-LabVIEW-as-client/m-p/3554863/h...

 

Thank you

 

Benoit

0 Kudos
Message 7 of 8
(144 Views)

Excellent!

0 Kudos
Message 8 of 8
(129 Views)