RESTful - ws_read Not Returning Endpoint

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

RESTful - ws_read Not Returning Endpoint

Postby bcusick » Tue Feb 21, 2017 6:07 pm

Hey Guys,

Don't know if any of you have seen this before...

I have a restful solution - and everything works great - EXCEPT - the first parameter to the ws_read is coming in as null - no matter what I do.

So - here's the URL:

Code: Select all
http://localhost:8080/servoy-service/rest_ws/prs_tracker_api/v1/studies/NCT02021175


Solution: prs_tracker_api
Form: v1

I was expecting to get the arguments:

Code: Select all
[0]: "studies"
[1]: "NCT02021175"


What I got was:

Code: Select all
[0]:  ""
[1]: "NCT02021175"


So then I tried another URL with more parameters:

Code: Select all
http://localhost:8080/servoy-service/rest_ws/prs_tracker_api/v1/repoorts/another/another2/another3/another4


and again I got everything back as expected - EXCEPT the first endpoint:

Code: Select all
[0]:  ""
[1]: "another"
[2]: "another2"
[3]: "another3"
[4]: "another4"


Any ideas are welcome! :wink:

SETTINGS:
Servoy 7.4.9
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.version=1.8.0_121
java.vm.info=mixed mode
java.vm.vendor=Oracle Corporation
os.name=Windows 10
os.version=10.0
Attachments
debugger.png
debugger.png (8.96 KiB) Viewed 468 times
Bob Cusick
bcusick
 
Posts: 1183
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Re: RESTful - ws_read Not Returning Endpoint

Postby patrick » Tue Feb 21, 2017 6:32 pm

I have just made a short test using solution "rest_ws", form "v1" and issued this request
Code: Select all
http://localhost:8080/servoy-service/rest_ws/rest_ws/v1/a/b/c/d/e/f

In the method I do

Code: Select all
function ws_read() {
   application.output(arguments[0]);
   application.output(arguments[1]);
   application.output(arguments[2]);
   application.output(arguments[3]);
   application.output(arguments[4]);
   application.output(arguments[5]);
   return 1;
}


and I get

a
b
c
d
e
f

Are you sure it was a get request you were issuing? A ws_create or ws_update method will receive your arguments from arguments[1] onwards, as they have the content of the request on arguments[0].

I am using Servoy 8.1.2 however, but I don't think that has been touched in a while.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3594
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: RESTful - ws_read Not Returning Endpoint

Postby bcusick » Tue Feb 21, 2017 7:38 pm

Hey Patrick,

Thank you very much for your quick reply! :)

It turns out it was a case of "stupid user detected". I had named a local variable that overwrote the param. :oops:

Again - thank you for your time!
Bob Cusick
bcusick
 
Posts: 1183
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA


Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests