From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

LabVIEW Web Service Error on Render ESP Template

Solved!
Go to solution

Hello

 

I was hoping people would be able to help with the following problem:

 

I am trying out the Embedded Server Page (ESP) scripting functionality of the LabVIEW webservices and keep receiveing an error when attempting to render a page.

 

I believe that I have set up the HTTP request handler correctly - buffered stream with headers

 

The correct template is located and used as the page renders upto the esp variable insertion point.

 

I find that the Address Book example works fine, except if I try and add an additional variable to the template, then the same error occurs.

 

I have attached an example project that displays the same behaviour and the error is below.

 

Tested on LabVIEW 2014 (14.0.1 SP1) 32 bit on 64 bit Windows 7.

 

Cheers

 

John

 

*****************************************************************************************************

 

Error -67035 occurred at NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi

Possible reason(s):

LabVIEW:  (Hex 0xFFFEFA25) LabVIEW Web Services: ESP Error.


Complete call chain:
     NI_WebServices.lvlib:Error Converter (ErrCode or Status).vi
     NI_WebServices.lvlib:Web Request.lvclass:Render ESP Template.vi
     Test.vi
     Test.vi.ProxyCaller

 

*****************************************************************************************************

0 Kudos
Message 1 of 9
(5,269 Views)
Solution
Accepted by topic author John_Neutron

Hi John_Neutron,

 

I've been working on your code today and we managed to replicate and fix the error you were seeing.

 

The Web service does call the ESP file and render the page, but it throws the error because the variable you are trying to set has not been properly declared. We managed to make the error dissapear by changing the ESP text file with notepad as follows.

--------------------------
<%
//This is a server side comment
// Variables:
var myvariable;
//
%>

<! Here comes the HTML >

<html>
<head><h1>This is the test template</h1></head>
</br>
<body> This is now the body:

<p>Here comes the varaiable</p>
<p>Variable: @@myvariable</p>

</body>

</html>
---------------------------

Before, you had // in front of the variable (making it a comment) and you didn't have "var" in front of it to say you were declaring anything (this is all in the 4th line). Without the proper declaration, the code throws an error when it is called.

 

Vsenior

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

Thanks for your help!

 

I had assummed that I was missing something with the variable decleration.

 

Cheers

 

John

0 Kudos
Message 3 of 9
(5,153 Views)

Hi John_Neutron, 

 

I actually have an Service request open for you after your request for support came through, would you be ok with me closing that off? If you run into more issues, you can call the NI office for help on 01635 523 545. 

 

All teh best

Vsenior

0 Kudos
Message 4 of 9
(5,145 Views)

Yup, feel free to close that.

 

John

0 Kudos
Message 5 of 9
(5,137 Views)

Just as an additional piece of knowledge...

 

I now realize where I was stumbling;

 

I though that the Render ESP Script .vi converted any dyanmic place holders (@@values) into the value that you have set using the Set ESP Variable.vi.

 

On reading the documentation for the Set ESP Variable.vi more closely, I saw that it actually sets values in a Javascript Hash (Key/value pair) called form.

 

So if you want to display the values that you set on the LabVIEW side, you need to use the form["LV_varaible_name"] construct.

 

This can either be done by initializing a variable using var myVariable = form["myVariableFromLabVIEW"] and then you can use  @@myVariable in your .esp file

 

or

 

you can directly insert the form value in the part of the ESP page that renders as html like this;

 

<p> This is my varaible: <% write(form["myVariableFromLabVIEW"]); %> </p>

0 Kudos
Message 6 of 9
(5,109 Views)

Hi VSenior i just beginner for Labview and i would like to learn about web service on labview, I want to stream my video capture from Webcam on MyRio, after looking for many references i found this site https://decibel.ni.com/content/docs/DOC-40808#comment-51856 , I run that project as well as the instruction, but i found the probolem same like John, i have read your solution, but i confused to change the code. Would you like to help me please? 

Maybe after get solution i'll more understand about it. 

 

Thank ya, I'll be happy for your respond 🙂 


Day@
Certified LabVIEW Associate Developer
0 Kudos
Message 7 of 9
(4,688 Views)

I have solved my own problem V, I really happy now 😄


Day@
Certified LabVIEW Associate Developer
0 Kudos
Message 8 of 9
(4,680 Views)

Hi hidayatmaulud

 

I'm pleased you managed to solve your problem ok! 

 

If you've got questions in the future, you can post in teh forums but I'd recommend starting a new thread for a new question.

 

I have changed jobs since I did this post, and the Applications Engineers who look after the threads might not have seen your request for help on the bottom of an old thread. 

 

All the Best

Vsenior

0 Kudos
Message 9 of 9
(4,668 Views)