Jump to content

8.6 Web service question


Recommended Posts

I have spent some time trying to figure this out and here is what I can tell you that might be helpful.

1. Web Service VIs run in a separate application instance from the LV EXE that starts the web server.

2. Web Service VIs 'think' they are the application that started the web server. (have your web service VI return the App.Name property and you will see what I mean).

3. If you want to talk to your EXE (or any EXE) form the web service VI, you must open an app reference to that EXE. If you try to just use the Default App Instance, you will get a reference to the app instance of the EXE that started the web server. If you have multiple EXEs, this can be a problem. If you have one EXE that acts as windows service to keep the web server running, then this fact will prevent you from calling into other EXEs.

4. If you use the Open Application Reference function and leave the machine name input blank (because your web service and your EXE are on the same local machine) then the app reference you will get will be for the app instance that your web service is running in, NOT your EXE, even if you supply a different VI Server port number that is unique to your EXE. It just will never work. I think this is a bug, IMHO.

5. In order to connect to your EXE, you must provide both the actual IP address of your machine and the VI Server port of you EXE. An easy way to get the IP is to wire the output of the 'String to IP' function into the input of the 'IP to String' function, set the use dot notation input to TRUE and do not wire anything into the 'String to IP' function. Wire the output of 'IP to String' into the machine name input on your Open Application Reference function.

post-2411-1240008951.jpg?width=400

I hope this saves someone some time. I wasted a day on this. Too bad NI chose not to document any of this...

Link to comment

QUOTE (jlokanis @ Apr 17 2009, 06:59 PM)

5. In order to connect to your EXE, you must provide both the actual IP address of your machine and the VI Server port of you EXE. An easy way to get the IP is to wire the output of the 'String to IP' function into the input of the 'IP to String' function, set the use dot notation input to TRUE and do not wire anything into the 'String to IP' function. Wire the output of 'IP to String' into the machine name input on your Open Application Reference function.

You should be able to wire the string "localhost" or the IP address 127.0.0.1 to get a connection to the local machine, rather than going through String to IP and back.

Link to comment

QUOTE (ned @ Apr 18 2009, 01:27 PM)

You should be able to wire the string "localhost" or the IP address 127.0.0.1 to get a connection to the local machine, rather than going through String to IP and back.

I will give that a try, but I doubt the 'localhost' string will work since that is the default value if left unwired and when I did that it definitely did not work.

Link to comment
  • 1 year later...

I have spent some time trying to figure this out and here is what I can tell you that might be helpful.

...

I hope this saves someone some time. I wasted a day on this. Too bad NI chose not to document any of this...

John, this was HUGELY helpful, but I did find it too late! Thank you so much for documenting this. I am just starting the process for learning these sort of "tidbits" under LV2010 application web server architecture. Hopefully, not much has changed regarding the instance-to-instance behaviors.

--

James

Link to comment
  • 6 months later...

Hey all!

Ned point me here to this thread, because i had a similar problem like NeilA. I want to connect a webmethod Vi with a Main Vi on another application instance.

I have rebuilt the solution appendage of Nathank and Ned and partly succeeded with Neds:

I can connect the two VIs, when i start them not out of project, but out of the windows explorer (Main Labview Application).

With Nathanks appendage I get an error, because, even when i have a project open, the Webmethod VI throws me an error, that no project is found and so i canĀ“t get an application ref.

So what i wanna do, is to connect the Webmethod and the Main.vi, even when the MainVI is run through a project. What i think is, that i need to find out what port number the open project has, so i can uniquely select it.

But maybe my approach is wrong, like NeilA iam a pretty rookie with G.

I hope you guys can help me fixing the problem.

Thanks a lot

Fred

Ps.: I attach a Screenshot of my working Version, which i rebuild from Ned. This works for the Main Labview Application instance. Like I said, i want to get it work for the MainVI in a project :-)

post-18615-0-92766000-1305877036_thumb.p

Link to comment

You can assign each project (or target within a project) a separate port number. In the project explorer, right-click My Computer and choose properties. On the VI Server page you can set a port number.

Link to comment

Hey Ned!

Thanks a lot, it's working. I set the port number for the project unter My Computer/ Properties. Then i added a "*" (access granted to everybody) to the access lists. And now i can open my MainVi from every application instance i want.

I use the OpenApp node with machine name "127.0.0.1" and the port number i set before!

You guys are great!

Greetz

Fred

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.