From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service cross domain

How to make a web service accessilble cross domain?

I am developping a web service with LabVIEW 2014 and I want to consume it from another domain.

On the other application (Non LabVIEW) I get the following error:

No 'Access-Control-Allow-Origin'.

 

Thanks in advance

 

Etienne

0 Kudos
Message 1 of 5
(4,954 Views)

I'm not that familiar with LabVIEW web services but have you checked the security access permissions on your web service VIs (and the application web server) to allow access from other hosts?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 5
(4,944 Views)

I am familiar with Web services in LabVIEW and I couldn't find the security access permissions for this particular items.

 

Thanks for your information

0 Kudos
Message 3 of 5
(4,941 Views)

Hi Didje007,

 

In order to access resources across domains from the browser you probably need to enable Cross-Origin Resource Sharing (CORS) in the webservice. The process for enabling CORS is described in the Using CORS: Adding CORS support to the server. I have not tried this myself in the LabVIEW Webservices but you can probably use the Set HTTP Header VI in your resouce VI to set the HTTP Header field "Access-Control-Allow-Origin" to the value "*" to allow any domain or specify the allowed domain.

 

See the Access-Control-Allow-Origin description in the tutorial and the Configuring HTTP Headers LabVIEW Help Topic. One thing to note from the tutorial is that additional headers are needed for requests other than HEAD, GET, and POST.


Milan
Message 4 of 5
(4,935 Views)
0 Kudos
Message 5 of 5
(3,306 Views)