<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hosting a WebVI with requests from LabVIEW Web Service in G Web Development Software</title>
    <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4292870#M481</link>
    <description>&lt;P&gt;What error shows up in the browser error console?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2023 14:13:35 GMT</pubDate>
    <dc:creator>IlluminatedG</dc:creator>
    <dc:date>2023-03-23T14:13:35Z</dc:date>
    <item>
      <title>Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4292815#M480</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I learned from this example how to create web application running on NI Web Server using LabVIEW Web Service to do some computation. I have no problem running on local machine, but when I try to open the web page on different machine in domain I only see WebVI but no results from LabVIEW Web Service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My link looks like this:&amp;nbsp;https://(machine name)/nxgproxy/55048/HtmlVI/Build/Web%20Server/Interactive/WebApp.gcomp/index.html&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I copied built project into&amp;nbsp;C:\Program Files\National Instruments\Shared\Web Server\htdocs&amp;nbsp;folder. HTTP method in LabVIEW looks like this:&amp;nbsp;&lt;A href="http://127.0.0.1:80/Web_Server/(VI" target="_blank"&gt;http://127.0.0.1:80/Web_Server/(VI&lt;/A&gt; name).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried different NI Web Server configurations - HTTP/HTTPS, CORS/no CORS,...&amp;nbsp; have deactivated firewalls on both server and client machines. But all in vain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously I have no problem with connection to remote machine NI Web Server but for some reason it does not communicate with LabVIEW Web Server on server machine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help!&lt;/P&gt;
&lt;P&gt;Marek.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 09:14:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4292815#M480</guid>
      <dc:creator>hlavam2</dc:creator>
      <dc:date>2023-03-23T09:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4292870#M481</link>
      <description>&lt;P&gt;What error shows up in the browser error console?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 14:13:35 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4292870#M481</guid>
      <dc:creator>IlluminatedG</dc:creator>
      <dc:date>2023-03-23T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293049#M482</link>
      <description>&lt;P&gt;127.0.0.1/Web_Server/GM_Init:1 &lt;BR /&gt;Failed to load resource: &lt;BR /&gt;net::ERR_CONNECTION_REFUSED&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DeployedRun.min.js:23704 &lt;BR /&gt;An unhandled error occurred on the LabVIEW diagram with code 363650 at HttpClientGet in NI::HTTP::httpWebServerClient.sli::httpWebServer_Get-&amp;gt;NI::HTTP::GET.gvi-&amp;gt;WebApp::index.gviweb&amp;lt;APPEND&amp;gt;&lt;BR /&gt;A network error has occurred. Possible reasons for this error include Cross-Origin Resource Sharing (CORS) configuration issues between the client and the target server or that the client cannot reach the target server. Due to browser security restrictions, detailed information about the cause of the network error cannot be provided. You may find specific details about the cause of the network error in the browser development tools console or in the LabVIEW output window.&lt;BR /&gt;&lt;BR /&gt;LogLabVIEWError @ DeployedRun.min.js:23704&lt;BR /&gt;DeployedRun.min.js:23704 &lt;BR /&gt;An unhandled error occurred on the LabVIEW diagram with code -375003 at Unflatten From JSON in WebApp::index.gviweb&lt;BR /&gt;&lt;BR /&gt;LogLabVIEWError @ DeployedRun.min.js:23704&lt;BR /&gt;127.0.0.1/Web_Server/Monitoring:1&lt;BR /&gt;Failed to load resource: net::ERR_CONNECTION_REFUSED&lt;BR /&gt;&lt;BR /&gt;DeployedRun.min.js:23704 &lt;BR /&gt;An unhandled error occurred on the LabVIEW diagram with code 363650 at HttpClientPost in NI::HTTP::httpWebServerClient.sli::httpWebServer_Post-&amp;gt;NI::HTTP::POST Buffer.gvi-&amp;gt;WebApp::index.gviweb&amp;lt;APPEND&amp;gt;&lt;BR /&gt;A network error has occurred. Possible reasons for this error include Cross-Origin Resource Sharing (CORS) configuration issues between the client and the target server or that the client cannot reach the target server. Due to browser security restrictions, detailed information about the cause of the network error cannot be provided. You may find specific details about the cause of the network error in the browser development tools console or in the LabVIEW output window.&lt;BR /&gt;&lt;BR /&gt;LogLabVIEWError @ DeployedRun.min.js:23704&lt;BR /&gt;DeployedRun.min.js:23704 &lt;BR /&gt;An unhandled error occurred on the LabVIEW diagram with code 363531 at PropertyNode_PropertyWrite in WebApp::index.gviwebMinimum value (0) must be less than the maximum value (0).&lt;BR /&gt;&lt;BR /&gt;LogLabVIEWError @ DeployedRun.min.js:23704&lt;BR /&gt;&lt;BR /&gt;DevTools failed to load source map: Could not load content for : HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE&lt;BR /&gt;&lt;BR /&gt;DevTools failed to load source map: Could not load content for : HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 17:24:44 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293049#M482</guid>
      <dc:creator>hlavam2</dc:creator>
      <dc:date>2023-03-24T17:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293166#M483</link>
      <description>&lt;P&gt;As the error described, the likely reason is that CORS isn't being configured/applied properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You attached a screenshot showing that remote access is installed but that's different from CORS. The default setting when choosing insecure remote access in the configuration wizard actually disables CORS. Do you have it enabled here?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="niwebcors.png" style="width: 562px;"&gt;&lt;img src="https://ip1.i.lithium.com/8ab0c7a89f9351964dc91c321b631848c7c7f82b/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313535303769393345453631313946463534384142452f696d6167652d73697a652f6c617267653f763d76322670783d393939" role="button" title="niwebcors.png" alt="niwebcors.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My assumption is you're probably trying to add CORS headers manually in the web service code itself but those get stripped by the server to prevent code that's running from having a say over CORS being enabled if it's not enabled at the server level.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 15:35:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293166#M483</guid>
      <dc:creator>IlluminatedG</dc:creator>
      <dc:date>2023-03-24T15:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293203#M484</link>
      <description>&lt;P data-unlink="true"&gt;Looking at the screenshots I can see that the WebVI is trying to make a request to&amp;nbsp;&lt;FONT face="courier new,courier"&gt;http://127.0.0.1:80/something&lt;/FONT&gt;&amp;nbsp;on the diagram.&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-unlink="true"&gt;While that makes sense when the hosting server, labview web service, and the webvi running in a web browser are all running on the same machine:&lt;/P&gt;
&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MilanR_0-1679673554902.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/c1980e643aadec89323a4be6dc10d5c82b97c080/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313535313669304636374138353741393037463346312f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="MilanR_0-1679673554902.png" alt="MilanR_0-1679673554902.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That does not work when the WebVI is running in a web browser on a separate machine. The URL hard coded in the diagram is pointing to the wrong server:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MilanR_1-1679673662071.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/bcfbfafeb7ff548fc4dd0a2fe6111f405333e95c/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313535313769434137393036414239323236424141452f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="MilanR_1-1679673662071.png" alt="MilanR_1-1679673662071.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So lets say you fix that and have the WebVI point to the correct server url on the diagram:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MilanR_2-1679674138749.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/e317ddc14b842a7d03e698627bb15a21b63d2e65/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313535313869443833343839333935304234343130362f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="MilanR_2-1679674138749.png" alt="MilanR_2-1679674138749.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing I noticed is that it does not seem like the LabVIEW web service is deployed to the NI Web Server. It seems to be running on the application web server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is true, the next issue you will hit is that the WebVI is hosted at a secure url with https enabled but is making a request to an insecure LabVIEW web server that is hosted via http. This is called a &lt;A href="https://web.dev/fixing-mixed-content/" target="_self"&gt;mixed content&lt;/A&gt; request and that is not allowed by browsers. A secure site making requests to an insecure site is blocked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you can fix that by either disabling https on the NI Web Server &lt;span class="lia-unicode-emoji" title=":worried_face:"&gt;😟&lt;/span&gt; or by trying to enable HTTPS on the LabVIEW Web Service (not as easy as the NI Web Server).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But then as you continue development the next issue you will likely hit is that LabVIEW Web Services have limited support for CORS requests (due to being unable to respond to OPTIONS HTTP requests). This will restrict the types of Web Methods you can support in your LabVIEW Web Service among other restrictions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this all sounds really complicated to you it's because you are starting in the hard mode cross-origin configuration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are just starting I strongly recommend going through the material and making the demos shown in the &lt;A href="https://bit.ly/webvi2022" target="_self"&gt;How to Build a Web UI for Your LabVIEW-Based Test System&lt;/A&gt; presentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The presentation discusses hosting the WebVI on the NI Web Server hosting service (which gives you a way to update WebVIs from a user interface instead of copying and pasting to a folder) and it shows how to deploy a LabVIEW Web Service to the NI Web Server so that your application runs in the much simpler same origin configuration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MilanR_4-1679675378047.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/499535de692e2381d27b358590b941a49faecac4/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313535323069303041383939443435413134313944312f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="MilanR_4-1679675378047.png" alt="MilanR_4-1679675378047.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the same-origin configuration you don't have to deal with CORS, you can use the NI Web Server in one spot to configure security settings, your LabVIEW Web Service is not restricted in the Web Methods you can use, running in the G Web Development IDE is easier, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are legitimate reasons to implement you system in a CORS configuration but I recommend starting with the approach shown in the presentation first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 16:32:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293203#M484</guid>
      <dc:creator>MilanR</dc:creator>
      <dc:date>2023-03-24T16:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293937#M488</link>
      <description>&lt;P&gt;Thank you both for the hints, so far I was trying out LabVIEW application server with https but with no luck. I'll follow your recommendations and let you know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Marek&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 08:38:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4293937#M488</guid>
      <dc:creator>hlavam2</dc:creator>
      <dc:date>2023-03-28T08:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Hosting a WebVI with requests from LabVIEW Web Service</title>
      <link>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4294264#M490</link>
      <description>&lt;P&gt;The webVI is finally functional without errors on other machines in domain. I did these steps:&lt;BR /&gt;1) Installed LabVIEW 2022 Q3 version (instead of LV 2019 which I think has no support for secure web server)&lt;/P&gt;
&lt;P&gt;2) Started hosting my LabVIEW project on secure NI Web Server (&lt;A href="https://127.0.0.1:443/Web_Server/" target="_blank"&gt;https://127.0.0.1:443/Web_Server/&lt;/A&gt;...)&lt;BR /&gt;3)&amp;nbsp;Enabled CORS in NI Web Server Configuration&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hlavam2_0-1680090177822.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/5908049d3179d336be820c2691f9dd09f5be9578/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313537363269444343304234453839393730363335382f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="hlavam2_0-1680090177822.png" alt="hlavam2_0-1680090177822.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4) Create HTTP requests using relative addressing instead of absolute&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hlavam2_1-1680090487840.png" style="width: 400px;"&gt;&lt;img src="https://ip1.i.lithium.com/af40b37ec8aa1b722842b510d974f30620365bf8/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f33313537363369454533343641394632313643363743452f696d6167652d73697a652f6d656469756d3f763d76322670783d343030" role="button" title="hlavam2_1-1680090487840.png" alt="hlavam2_1-1680090487840.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for your help!&lt;/P&gt;
&lt;P&gt;Marek&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.: these videos are very helpful:&lt;BR /&gt;&lt;A href="https://forums.ni.com/t5/Example-Code/How-to-Build-a-Web-UI-for-Your-LabVIEW-Based-Test-System/ta-p/4233446" target="_blank"&gt;How to Build a Web UI for Your LabVIEW-Based Test System - NI Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=iji_69tzcNM" target="_blank"&gt;NI Web Intro - HTTP, GET, &amp;amp; Dynamic Images - YouTube&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 11:52:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/G-Web-Development-Software/Hosting-a-WebVI-with-requests-from-LabVIEW-Web-Service/m-p/4294264#M490</guid>
      <dc:creator>hlavam2</dc:creator>
      <dc:date>2023-03-29T11:52:52Z</dc:date>
    </item>
  </channel>
</rss>

