Jump to content
Sign in to follow this  
dante_34

problem with HTTP, cookies and external web services(RESTful)

Recommended Posts

Hello

 

I have a problem with http VI’s and external web services (RESTful) and I’m using LabVIEW 2013.

 

In NetBeans I create a project with a GET web service from a table in MySQL, so I use http VI’s for accessing the service (blog diagram .png), receiving the information in JSON (front panel.png) and took the information I needed (in this case the “slActualValue†value).

 

I have a program that inserts new values in the database and in chrome the service works fine but if a want to do the Vi in a while loop to update or receive new values, the the next JSON data form the web service is the same as the first call, but if I go to the NetBeans project and do the deploy again the JSON data changes.

 

I ask about this problem from the experts in web services (RESTful) and they say that is the cookies in the LabVIEW program, so I create add a cookie file .txt but im not confident about the format of the file(the example is in this post) or if there something amiss in the LabVIEW VI’s

 

Cookie.txt file

# Netscape HTTP Cookie File

# http://curl.haxx.se/rfc/cookie_spec.html

# This file was generated by libcurl! Edit at your own risk.

 

UNKNOWN        FALSE    10.18.9.32:8080/arto      FALSE    0             ID           0

post-53246-0-81800100-1424364552.png

post-53246-0-16057600-1424364553_thumb.p

Share this post


Link to post
Share on other sites

Cookies are set by the server. You are just telling the labview client where to store it so whatever you put in there will be overwritten at some point.

 

The data is probably being cached and you are getting the cached values. Try adding the folloing headers.

 

Cache-Control : no-cache, must-revalidate, max-age=0

Pragma : no-cache

Share this post


Link to post
Share on other sites

Hello 

 

I tried:

 

add the headers in VI, in the web service, disable the cache form the glassfish server and activate pool, lower the timeout of the cache and pool, but until now nothing  

 

Cookies are set by the server. You are just telling the labview client where to store it so whatever you put in there will be overwritten at some point.

 

The data is probably being cached and you are getting the cached values. Try adding the folloing headers.

 

Cache-Control : no-cache, must-revalidate, max-age=0

Pragma : no-cache

Share this post


Link to post
Share on other sites

The labview webbrowser stuff is pretty crappy.

 

Use a .net webBrowser control, navigate, get the document and you can pretty much do what you want using standard .net calls, and really gives you better control over the browser (which is IE version on your machiene)

 

At this point you can pretty much google how to get stuff, just look to use visual basic or C# and follow the .net calls putting them in labVIEW.  

 

Enjoy!

post-17025-0-83852600-1424901335_thumb.p

Get Webpage Stuff.vi

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.