キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Limiting plot by timestamp from a SQL DB using POST method - LV 2016 & NXG 3.0

解決済み
解決策を見る

Hello guys,

I am trying to update a chart limiting by timestamp. I am sending a SQL string from my webvi to my webserver.

The string is correct, i tested isolated, but when I sent from my webvi to my webser I get the following errors.

 

history_post-vi.jpgerror_nxg.jpgI also attached my vis to help finding any solution  

すべてをダウンロード
0 件の賞賛
メッセージ1/6
4,676件の閲覧回数

Hi Granado_93,

 

I think the issue may be similar to one we discussed before in the LabVIEW 2016 Web Server and web page with Labview NXG 3.0 post. In the example provided it looks like the Historico.vi needs to be marked as Streaming and to enable Use headers and Buffered.

 

streamingresponse.PNG

 

One thing to point out is that it can be dangerous to accept and run SQL statements from a web page. A WebVI running in a webpage on your computer is no different than any other web page you visit in a web browser. It is possible for a malicious web page to send an SQL statement to your LabVIEW Web Service that can do unexpected operations.

 

Some best practices are to not send SQL queries from your WebVI to the Web Service but instead send specific parameters that you sanitize on the LabVIEW Web Service. For example in this case your SQL query has two timestamps as parameters. Instead of building the sql query in the WebVI and sending it to the LabVIEW Web Service you can send the two timestamps, parse them to make sure they are valid timestamps, and build / run the SQL query in the LabVIEW Web Service.


Milan
メッセージ2/6
4,655件の閲覧回数

Hi MilanR

 

I changed the output type to stream as you told. But it did not work yet. I have the same error that I had in the previous exemple.

NGX still complains that CORS is not presented on the request source, even though I had the CORS block on my web server.

Am I missing something else?

regards

0 件の賞賛
メッセージ3/6
4,641件の閲覧回数

Hello MilanR,

 

I did the modifications as follows historico_nxg.PNGhistorico_vi.PNGBut still, I got the same error about CORS.

 

I tested and my web server don't receive nothing from my webvi.

0 件の賞賛
メッセージ4/6
4,637件の閲覧回数
解決策
トピック作成者Granado_93が受理

Hi Granado_93,

 

Looking at the Historico.vi Web Resource more closely I see two issues. The first is that the Historico.vi is configured to respond to GET requests but the WebVI is sending a POST request. If the Historico.vi should respond to the WebVI as is then it should be changed to respond to POST requests.

 

The second issue is that the Historico.vi does not have the LabVIEW Web Service Request control connected to the connector pane. You have to have the class reference connected to the connector pane to be used by the LabVIEW Web Service.


Milan
メッセージ5/6
4,627件の閲覧回数

Hi MilanR

It should be POST, I think I changed to test something else.

 

BUt you were right about the LabVIEW Web Service Request control. I connected the control to the connector pane and send two string as timestamp and it works as I wish it.

 

Thank you for your help!

 

0 件の賞賛
メッセージ6/6
4,625件の閲覧回数