Jump to content

Datasocket and 404 error


Recommended Posts

Anyone know if it's possible to force DataSocket Read.vi to return the raw text of an HTTP response, even if there was an error code (for example 404 error or 500 error)? For example if you set your browser to "http://www.google.com/blah", the google server responds with a customized 404 error web page, which the browser correctly displays. DataSocket Read.vi does not return the raw text of the customized 404 error page.

More background:

I am using DataSocket Read.vi to make HTTP requests of various URLs. For example, "http://localhost/mywebservice" or "http://www.google.com" as the "connection in" input. Works great for retrieving the raw text of the web page. My specific use is to call local web services on several computers on our local LAN - web services which perform various hardware control actions on equipment in the lab and then return a simple response in XML or plain text.

Sometimes I need to append "[text]" to the url if the data is formatted as XML or other formats in order for DataSocket Read.vi to return the response. Again, works great for my needs.

However, if the web server returns an error code, for example 404 error or 500 error, then DataSocket Read.vi returns an error and does not return the plain text of the response.

The issue is that one of the web services we use returns a 500 error in addition to describing the error condition in the XML response - and DataSocket Read.vi returns with "Error 1184 // Path not found, FTP login incorrect, or no FTP write permission" rather than returning the raw text of the XML response with the error description. Calling the URL from a browser correctly displays the raw text of the XML response, so I know it's a DataSocket or Labview issue.

I am not using the Internet Toolkit. Since DataSocket Read.vi met my needs (with this one exception) I had no use to purchase the Internet Toolkit. Seems silly to purchase the entire Toolkit for this one feature. I suspect that the Toolkit would do the right thing, though I have not tried, preferring to use built-in functions. If the answer is that the Toolkit is the best/only way to do what I want, that answer if valuable to me as well, even if disappointing.

I'm using LV2010SP1 on Win7, and have LV2011 disks on my desk waiting to be installed.

Any thoughts or suggestions appreciated.

thanks,

Martin

Link to comment

Thanks Shaun. If installing LV2011 solves my issue, then I may as well stop procrastinating (ie the disks are just sitting here waiting).

Interestingly, once you mentioned the LV2011 http vis, I discovered that those same vis appear to have shipped when LV2010SP1 came out, and that I have them already...

I gave the GET HTTP.vi a try and voila, success! Problem solved.

Thanks!

Link to comment

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.

×
×
  • Create New...

Important Information

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