LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service and Dynamic dispatch VI

Hello,

 

I would like to know if it is possible to call a dynamic dispatch Vi in a Web Server?

 

The reason I'm asking is that I have a 500 Server error when calling one of my web services after the third call ( the first call is always ok) and in the mean time the other web service are replying with no error and I found this document on the labview manual.

 

I made an architecture relying on plugins in PPL and a web service which indicates the information needed to configurate each plugin. The value returned by this web service has to be treated by a dynamic dispatch vi.

 

Thanks in advance for any help.

 

 

0 Kudos
Message 1 of 9
(2,859 Views)

Short answer: yes - you can use dynamic dispatch in a Web Service.

 

My build server is triggered by POST requests which are handled by a LabVIEW web server, and it uses the content of the HTTP message to determine how to handle the message.

 

If you can show some code, or describe in more detail the methods that error and the surrounding decision-making code, it might be possible to give a more useful, longer answer.


GCentral
0 Kudos
Message 2 of 9
(2,834 Views)

Thank you for your answer.

I was asking this because this web service is the only one with the problem and the only one with dynamic dispatch VI.

 

I can't find where the server error comes from. Since it is only one using dynamic dispatch and because of the link I had to ask.

 

The code isolated and in the the labview environment does not generate an 500 error server.

The error is generated by the embedded web server in my application. it is a generic Web server error

 

Access Error: 500 -- Internal Server Error

Internal Server Error

 

And nothing appears in the Web server log (I've set it so that it logs message up to level5) but no message are found after it starts.

 

didje007_0-1579518726969.png

Obtain gets a path from a DVR objetct. to list the lvlipb installed. I then run the object for each lvlip found and create a JSON wich is send as stream.
The vi with a green header are my Web service handler. I log every request received and this one is not transmited to the vi when i doesn work.

 

0 Kudos
Message 3 of 9
(2,825 Views)

I'd suggest manually logging to file the JSON text which is being sent and checking that it matches what you expect. Probably logging the path at the same time is worth the extra effort because if the result from the JSON is not what you want, you'll likely immediately want to know the path it scanned.

 

Is this the VI that throws the error? You can also use the same (or a different) log file to write down the source string along with timing and the error code of errors that pop up. The call chain can be useful when troubleshooting.


GCentral
0 Kudos
Message 4 of 9
(2,818 Views)

This is the actual vi that throws an error, but it is not even executed.

The web server does not transmit the call to the VI. The error is generated by the web server before it reaches the Vi. ( the request error after 6ms when the Vi is executed it is more 20ms)

Therefore logging anything in the vi is useless because the first call is ok, the second may be ok but all calls afther the third gnerates an error.

 

My need would be to understand why the web server does not tranmit the request to the VI.

0 Kudos
Message 5 of 9
(2,808 Views)

Is this VI being called in the loop of a StartUp VI, or is it a Web Resource?

Since you're repeatedly reading the Path via the DVR, is it possible something happens to the DVR and you're getting an empty/invalid path?

 

If you're sure this VI is the problem, I'd definitely suggest logging the path and the cluster or JSON string to file (JSON string will naturally be easier to write).

Perhaps something happens on the second call that breaks future calls, perhaps the DVR returns an empty path for some reason and so the List is empty making the operation much faster, etc.


GCentral
0 Kudos
Message 6 of 9
(2,802 Views)

The Vi is a Web ressource.

 

While the web service runs, the vi is correctly executed multiple times in the developement environement.

But in executable I have an error.

Logging anything of the VI call is useless because the vi is not executed, it doesn't actually run. I have a log of all the request and it doesn't appear in this log.

I've managed to log events from the server and the here is the result.

 

The first two request are OK (line 21 to line 81 then 86 to 147)

Then I send exactly the same request and error 500 happens.

Line 150 shows the request is well received by the server. Error on line 184 suggest the Web service is in error.

0 Kudos
Message 7 of 9
(2,795 Views)

Well, I guess I don't have any more suggestions, sorry!

 

If you're sure that there's no problem until after completion of the second time (note that the last VI you have, Handle HTTP Error Reply or similar, executes after you write the cluster in the second response and might be able to generate some kind of issue, and that the DVR remains valid and nothing else goes differently for the 3rd attempt, and the problem always occurs on the 3rd attempt, I don't know where else you could look.

 

Is it possible your application is somehow crashing separately from the web service, or you're running out of memory on your embedded target or something?

Is the timing always consistent between requests (in which case maybe your service has problems after a specific time) or is it always the 3rd attempt regardless of timing between attempts?

If you change the PPLs available in the directory, do you get different behaviour?

How about if you temporarily wire a constant path (instead of using the DVR and plugin manager path)?


GCentral
0 Kudos
Message 8 of 9
(2,783 Views)

Thank you for your help.

I haven't found a solution. All I know this is teh only web service that makes this error. the other web services keep working.

The DVR is used without problem by other webservices. I've replace this with a constant and the error was still here. Therefor it must be something in the FOR Loop.

For the moment I found a work around for the code I wanted but I still don't understant why it doesn't work this way.

It is not at all dynamic and I will try to sort this problem later.

 

My tests show it has nothing to do with the timing. It depends on the PC on which it runs.

 

At least now I know all the debug options available for the labview embedded web server.

0 Kudos
Message 9 of 9
(2,769 Views)