Jump to content

How to create a web service via scripting


Recommended Posts

I haven't done much with vi scripting, so I might have thrown myself into the deep end here, but this is it: Is it possible to create a new web service in my existing project and then do all the configuration via scripting too? Or can I create a web service from template so that I don't have to do all the configuration in scripting?

 

I tried googling but all results were for scripting *in* web services.

Link to comment

I haven't done much with vi scripting, so I might have thrown myself into the deep end here, but this is it: Is it possible to create a new web service in my existing project and then do all the configuration via scripting too? Or can I create a web service from template so that I don't have to do all the configuration in scripting?

 

I tried googling but all results were for scripting *in* web services.

I put together something which imports a web service into your project from a template. Its really hacky and may not work for all web services (in fact it no longer works for the web service I originally wrote it for, although I plan to fix that at some point).

The code is on this download page:

https://decibel.ni.com/content/docs/DOC-38927

Specifically ni_cvt_web_addon-1.6...

I'd just unzip it and open the vi ni_cvt_web_addon-1.6.0.1\File Group 0\project\AddCVTWebServiceToProject.vi

 

Also, be sure not to judge me based on that code. :)

Link to comment

Oh well :(

 

Edit:

Was just looking back through it and I remembered all the issues I had getting it to work at all. Things like guids and paths just didn't get set as I would expect. You can always dig through some of the other code in the same directory, but its pretty hard to understand what the different functions are doing.

Link to comment

Try this:

attachicon.gifWebService.png

 

Of course, I had gotten that far and then looked at the help which didn't list "Web Service" under Type. The part that the list only contains the *most common* types I had completely ignored ... :book:

 

Also loving the "Get All Descendents" method. With its help I was able to figure out how to get hold of the automatically created sub folders of the Web Service and how to add items to them. A quick look at the project file revealed some missing properties, which I decided to set using "Set Tag". I'm assuming that's the correct, and only way?

<Property Name="ws.buffered" Type="Bool">true</Property>

post-28303-0-67480500-1438038761.png

Link to comment

Just remeber to save the project as well ;-)

I have seen in the past that if you write a Tag Value and then read it later the Tag Value could read the old value, even if the project is saved and the Tag value in the XML file has been updated.

So in some instances I actually open and parse the XML file, just to be sure.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.