Hello;
First of all, I want to say that I am a new visual designer user and I am only a RGP developper.
I want to use Dynamic Auto-complete with a rest webservice, calling an RPG program.
I have deploy my RPG program as a REST webservice.
I have put the URL in the Choice URL of the textbox.
When I call my URL, the webserbice sends some data.
When I call the program, it looks like the webservice isn't call. When I debugg with firedebug, I have this message :
It is as if the webservice was call with an authentification.
Is it a problem with my webservice server or is there something wrong with the way I try to do this?
Thank you
Guillaume
Dynamic Auto-Complete and webservice
-
- New User
- Posts: 3
- Joined: Wed Feb 10, 2016 6:59 am
- First Name: FRERY
- Last Name: Guillaume
- Company Name: MB Expansion
- City: BOURG EN BRESSE
- State / Province: Outside Canada/USA
- Zip / Postal Code: 01000
- Country: France
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Dynamic Auto-Complete and webservice
Hello,
I see a few problems:
1) You are not passing the full URL.
On the one that you show working, the URL is
http://as400dev:10021/web/services/ws_articl2/baignoire
In Profound UI, the URL is:
http://as400dev:10021/web/services/ws_articl2/
Since this last URL is missing the 'baignoire' portion of the URL, you get a 404 not found error.
2) JSON data is case-sensitive.
Your properties ("success", "response", "results", etc) are in all uppercase, but Profound UI is expecting them to be in lowercase.
3) Web browsers typically only allow you to send requests to the same HTTP server that sent the page you're on. Sending/receiving from another domain creates a "cross-domain" request, which browsers will often block for security reasons. To avoid this you must use the same server & port number for the web service as you do for the Profound UI page, or use a workaround like a proxy.
If I were you, I would consider using Profound's UNIVERSAL handler or similar for this web service instead of IBM's IWS. But, of course, that's up to you.
I see a few problems:
1) You are not passing the full URL.
On the one that you show working, the URL is
http://as400dev:10021/web/services/ws_articl2/baignoire
In Profound UI, the URL is:
http://as400dev:10021/web/services/ws_articl2/
Since this last URL is missing the 'baignoire' portion of the URL, you get a 404 not found error.
2) JSON data is case-sensitive.
Your properties ("success", "response", "results", etc) are in all uppercase, but Profound UI is expecting them to be in lowercase.
3) Web browsers typically only allow you to send requests to the same HTTP server that sent the page you're on. Sending/receiving from another domain creates a "cross-domain" request, which browsers will often block for security reasons. To avoid this you must use the same server & port number for the web service as you do for the Profound UI page, or use a workaround like a proxy.
If I were you, I would consider using Profound's UNIVERSAL handler or similar for this web service instead of IBM's IWS. But, of course, that's up to you.
-
- New User
- Posts: 3
- Joined: Wed Feb 10, 2016 6:59 am
- First Name: FRERY
- Last Name: Guillaume
- Company Name: MB Expansion
- City: BOURG EN BRESSE
- State / Province: Outside Canada/USA
- Zip / Postal Code: 01000
- Country: France
- Contact:
Re: Dynamic Auto-Complete and webservice
Hello Scott;
Thank you for your answer.
First, I don't pass the full URL, because the end of the URL (baignoire) is the search argument, corresponding to the auto-complete text.
I didn't know there is a profound's universal handler for the webservices. I will try to make a look on the forum to see if there are exemples to do what I want.
Best regards
Thank you for your answer.
First, I don't pass the full URL, because the end of the URL (baignoire) is the search argument, corresponding to the auto-complete text.
I didn't know there is a profound's universal handler for the webservices. I will try to make a look on the forum to see if there are exemples to do what I want.
Best regards
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Dynamic Auto-Complete and webservice
Profound UI isn't going to automatically add the search term on to the URL, so if you want to use a web service like this one, you'll need to add the search term onto the URL yourself, possibly by calling an RPG program that calls the web service, or maybe with URL rewriting in Apache (I'm not completely sure if URL rewriting will work, but it might be worth looking into.)guillaume.frery wrote:First, I don't pass the full URL, because the end of the URL (baignoire) is the search argument, corresponding to the auto-complete text.
-
- New User
- Posts: 3
- Joined: Wed Feb 10, 2016 6:59 am
- First Name: FRERY
- Last Name: Guillaume
- Company Name: MB Expansion
- City: BOURG EN BRESSE
- State / Province: Outside Canada/USA
- Zip / Postal Code: 01000
- Country: France
- Contact:
Re: Dynamic Auto-Complete and webservice
Scott;
Thank you for this information.
I am trying to do the auto-complete on the text box, with the RPG program, but I have another issue.
On the 'onkeyup' properties, I have put the pui.click(); javascript, so my RPG program can run. The RPG, is calling the webservice which will return data selection for the text box. I put this data in 2 fields, with comma separators, and I have attache this fields on the auto-complete of the text box. When I run the RGP, I have a program message
Do you have an idea for this issue?
Thanks a lot
Guillaume
I have found my issue !
It was a problem in the webservice : the program was doing a RCLRSC.
I apologise for the inconvenience.
Thank you for this information.
I am trying to do the auto-complete on the text box, with the RPG program, but I have another issue.
On the 'onkeyup' properties, I have put the pui.click(); javascript, so my RPG program can run. The RPG, is calling the webservice which will return data selection for the text box. I put this data in 2 fields, with comma separators, and I have attache this fields on the auto-complete of the text box. When I run the RGP, I have a program message
Do you have an idea for this issue?
Thanks a lot
Guillaume
I have found my issue !
It was a problem in the webservice : the program was doing a RCLRSC.
I apologise for the inconvenience.
-
- Profound User
- Posts: 24
- Joined: Thu Jan 07, 2016 9:24 am
- First Name: Zoe
- Last Name: W
- Company Name: Previously Anker International
- Country: United Kingdom
- Contact:
Re: Dynamic Auto-Complete and webservice
*edit*
After writing a post about how I couldn't get auto-complete to work with a dynamic URL, it worked... I think this is due installing 5.4.
I was able to achieve it by creating the URL as part of the on-blur event of the element (selToWhs) which precedes the one I wanted auto-complete to work on (selToLoc).
On-blur event of selToWhs:
E.g.
The resulting URL for 'choices url' is then "http://systemi:8080/profoundui/universa ... &QPRD=BDGK", when I look at the HTTP POST I see this as the URL and 'query' as the post data.
We are using Universal Display with an RPG program (as defined in PUIMAPP), the RPG uses QWHS, QPRD and query to return a list of values for auto-complete.
Zoe
After writing a post about how I couldn't get auto-complete to work with a dynamic URL, it worked... I think this is due installing 5.4.
I was able to achieve it by creating the URL as part of the on-blur event of the element (selToWhs) which precedes the one I wanted auto-complete to work on (selToLoc).
On-blur event of selToWhs:
E.g.
Code: Select all
myURL = http://systemi:8080/profoundui/universal/whsUtils?REQTYPE=*LOCSAUTO&QWHS=" + get("selToWhs").substring(0, 2) + "&QPRD=" + get("selprod")
applyProperty("selToLoc", "choices url", myURL);
applyProperty("selToLoc", "field type", "textbox");
We are using Universal Display with an RPG program (as defined in PUIMAPP), the RPG uses QWHS, QPRD and query to return a list of values for auto-complete.
Zoe
- Glenn
- Profound Logic Staff Member
- Posts: 124
- Joined: Mon Apr 14, 2014 4:08 pm
- First Name: Glenn
- Last Name: Hopwood
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: Dynamic Auto-Complete and webservice
Zoe,
URLs have rules on how special characters (spaces, question marks, etc.) should be encoded so, to avoid possible future issues where your 'selToWhs' or 'selprod' data might contain them, you might want to URI encode the URL. I would do something like below (Note that I haven't tested this...).
More info here:
http://www.w3schools.com/jsref/jsref_en ... ponent.asp
Glenn
URLs have rules on how special characters (spaces, question marks, etc.) should be encoded so, to avoid possible future issues where your 'selToWhs' or 'selprod' data might contain them, you might want to URI encode the URL. I would do something like below (Note that I haven't tested this...).
Code: Select all
myURL = http://systemi:8080/profoundui/universal/whsUtils?REQTYPE=*LOCSAUTO"
myURL += "&QWHS=" + encodeURIComponent(get("selToWhs").substring(0, 2));
myURL += "&QPRD=" + encodeURIComponent(get("selprod"));
http://www.w3schools.com/jsref/jsref_en ... ponent.asp
Glenn
-
- Profound User
- Posts: 24
- Joined: Thu Jan 07, 2016 9:24 am
- First Name: Zoe
- Last Name: W
- Company Name: Previously Anker International
- Country: United Kingdom
- Contact:
Re: Dynamic Auto-Complete and webservice
Many thanks Glenn, I'll add that to my code.
Who is online
Users browsing this forum: No registered users and 2 guests