08-20-2012 05:36 AM
Hello,
I try to write a web service program and I want to receive some string data from the client, but I don't know how to use the Read Postdata.vi, any one can help?
NathanL1989
08-21-2012 12:33 PM
Hi NathanL,
Please describe in more detail exactly what you are trying to accomplish. Off hand I would suggest looking into ReadFormData.vi as an alternative. Also please upload the files you have thus far so I can reporduce where you are running into trouble.
08-23-2012
06:13 AM
- last edited on
01-13-2025
08:57 AM
by
Content Cleaner
Hello,
I try to write a web service program and I want to receive some string data from the client, but I don't know how to use the Read Postdata.vi, any one can help?
NathanL1989
To receive some data in "Read Postdata.vi", you should deploy the vi having "Read Postdata.vi" as POST method.
Then you cannot post data to a service by typing a URL in browser. Instead use POST.vi in LabVIEW or use HTML forms to post some data.
1. Create a project
2. Create a vi as below and add to the project
Note: Connect the "httpRequestID", "httpRequestID out" to connector pane terminals.
3. Create a Web Service (RESTful) from Build specification.
4. Goto Web Service->Properties
5. Add this vi to Service vi in "Source files" tab
6. Configure the URL Mapping in "URL Mapping" tab
7. Select POST in HTTP method. (This setting is most important)
8. Build and Deploy the service.
9. Now create a vi as below.
10. Fill in the IP address and other data. For more details on how to get these details please visit http://www.ni.com/white-paper/7350/en
11. You will get the posted data in the vi deployed as Web service.
(To check whether the data is being posted successfully or not, write the posted data to a file other than desktop in vi that is deployed as Web service.)
11-23-2012
10:46 PM
- last edited on
01-13-2025
08:57 AM
by
Content Cleaner
Thanks to Anand for that thorough walk-through. I have been struggling with similar issues. I have one further question:
In step 6, Anand said "Configure the URL Mapping in "URL Mapping" tab". For the example snippet that Anand posted, what would the URL mapping look like?
Do I need to create a map to the "httpRequestID" controls and indicators? Should I use ":/" to denote the control?
To further clarify my question, when I have done simpler Web Services projects, I have written to the controls in the URL, as show in this tutorial: http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/build_web_service/
In that case, I created a URL Map like this: /add/:a/:b, where "a" and "b" were controls. When using the Web Services VIs, however, I can't figure out how to connect my URL Map to the "httpRequestID" control.
Any advice is appreciated!
Luke