02-20-2013 04:55 PM
I'm currently fighting this "Same Origin Policy" issue :(. JSONP does not seem to work, and CORS requires that I reply with the origin of the request in my HTTP header which I'm not sure how to get my LabVIEW Web Service to do that.
Getting a reverse proxy worked out may not be a possibility because I do not have administrative control over the production server that will host my HTML/Javascript frontend. Not sure what to do to make my LabVIEW Web Service work...
I can't even get this to work on my localhost unless I setup a reverse proxy.
The service I'm using to get things going is a simple adding service that takes the form:
http://localhost:808...:input1/:input2
Where the output is the summation of the two inputs. So for example if I were to do a GET request for http://localhost:8080/add/1/2 the return would look like:
<Response>
<Terminal>
<Name>Output</Name>
<Value>3.000000</Value>
</Terminal>
</Response>
Basic javascript section of code:
$.ajax({
type:"GET",
url:"http://localhost:8080/add/1/2",
success:function(data){
alert(data);
}
});
I'm on LV 2012. Thanks for the help.
02-20-2013 05:14 PM - edited 02-20-2013 05:14 PM
Also, Jolt's demo files work fine when I open his index.htm in Internet Explorer 8 but I get a big script security warning that I have to say "It's OK!" to. I had to modify index.htm to point to port 8080 (where my web services are running from).
In Firefox 18 (latest version) I get nothing. I suspect it is because of this "Same Origin Policy".
02-20-2013 08:32 PM
I think that the best solution is to just include a static folder with your html files and images then rely on the LabVIEW Web Services server serve the files.
Otherwise you have to mask the requests using some proxy to get around the client side security concerns. Would love to see LabVIEW support JSONP.