Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 12 total |
TServerRequest not reaching remote php webservice |
Sun, Aug 20 2017 10:09 PM | Permanent Link |
Stephen Kenny | I've got a test web service - very simply php script that just logs the action and returns some text - to test reading & writing while using the IDE.
I've copied the Login example, and changed the url to my (fully qualified) remote address. (I know it works OK as I can run it from the browser address bar). I'm getting no response at all - just blank - and it isn't loading the web service (no entries in the log). I've set the cross site setting in the Webserver Content tab. I'm doing this from the IDE, i.e. while developing. What am I doing wrong? Stephen |
Sun, Aug 20 2017 11:57 PM | Permanent Link |
Raul Team Elevate | On 8/20/2017 10:09 PM, Stephen Kenny wrote:
> I've got a test web service - very simply php script that just logs the action and returns some text - to test reading & writing while using the IDE. > I've copied the Login example, and changed the url to my (fully qualified) remote address. (I know it works OK as I can run it from the browser address bar). > I'm getting no response at all - just blank - and it isn't loading the web service (no entries in the log). You can use browser debug tools to see what happens but looks like a classic CORS issue to me. > I've set the cross site setting in the Webserver Content tab. > I'm doing this from the IDE, i.e. while developing. Allow CORS must be set on the web server hosting the content - in this case whatever is hosting your PHP script must allow it. Raul |
Mon, Aug 21 2017 4:33 AM | Permanent Link |
Stephen Kenny | Thanks very much for the reply, but I've tried the same thing with a Delphi app, and that connects just fine to the same test web service, from the IDE on the same PC.
Raul wrote: On 8/20/2017 10:09 PM, Stephen Kenny wrote: > I've got a test web service - very simply php script that just logs the action and returns some text - to test reading & writing while using the IDE. > I've copied the Login example, and changed the url to my (fully qualified) remote address. (I know it works OK as I can run it from the browser address bar). > I'm getting no response at all - just blank - and it isn't loading the web service (no entries in the log). You can use browser debug tools to see what happens but looks like a classic CORS issue to me. > I've set the cross site setting in the Webserver Content tab. > I'm doing this from the IDE, i.e. while developing. Allow CORS must be set on the web server hosting the content - in this case whatever is hosting your PHP script must allow it. Raul |
Mon, Aug 21 2017 5:17 AM | Permanent Link |
Stephen Kenny | Now I try, I can't find how to use the code debug tool, or the browser debug tool.
Raul wrote: On 8/20/2017 10:09 PM, Stephen Kenny wrote: > I've got a test web service - very simply php script that just logs the action and returns some text - to test reading & writing while using the IDE. > I've copied the Login example, and changed the url to my (fully qualified) remote address. (I know it works OK as I can run it from the browser address bar). > I'm getting no response at all - just blank - and it isn't loading the web service (no entries in the log). You can use browser debug tools to see what happens but looks like a classic CORS issue to me. > I've set the cross site setting in the Webserver Content tab. > I'm doing this from the IDE, i.e. while developing. Allow CORS must be set on the web server hosting the content - in this case whatever is hosting your PHP script must allow it. Raul |
Mon, Aug 21 2017 6:01 AM | Permanent Link |
Stephen Kenny | It works fine deployed, but it'll be a pain if I can't develop this data stuff from the IDE
Any ideas? Would it help if I sent you the url? Stephen Kenny wrote: Thanks very much for the reply, but I've tried the same thing with a Delphi app, and that connects just fine to the same test web service, from the IDE on the same PC. Raul wrote: On 8/20/2017 10:09 PM, Stephen Kenny wrote: > I've got a test web service - very simply php script that just logs the action and returns some text - to test reading & writing while using the IDE. > I've copied the Login example, and changed the url to my (fully qualified) remote address. (I know it works OK as I can run it from the browser address bar). > I'm getting no response at all - just blank - and it isn't loading the web service (no entries in the log). You can use browser debug tools to see what happens but looks like a classic CORS issue to me. > I've set the cross site setting in the Webserver Content tab. > I'm doing this from the IDE, i.e. while developing. Allow CORS must be set on the web server hosting the content - in this case whatever is hosting your PHP script must allow it. Raul |
Mon, Aug 21 2017 8:27 AM | Permanent Link |
Raul Team Elevate | On 8/21/2017 4:33 AM, Stephen Kenny wrote:
> Thanks very much for the reply, but I've tried the same thing with a Delphi app, and that connects just fine to the same test web service, from the IDE on the same PC. There is no CORS (nor browser) involved with delphi app yes so it woudl work. Similarly you can type url directly in the browser like you did and it also works (that is browser equivalent of what your delphi app does). CORS is specific to WEB apps and is enforced by the browser - it means that your app was loaded from URL A but it makes requests to URL B. if this were always allowed then it would be instant phishing and denial of service attack vector - for security site B must allow requests from other source URLs. Ways to get around this are 1. Host the Javascript/EWB app from the same server as your data 2. Enable CORS on domain B for A (or all source URLS) Raul |
Mon, Aug 21 2017 8:30 AM | Permanent Link |
Raul Team Elevate | On 8/21/2017 6:01 AM, Stephen Kenny wrote:
> It works fine deployed, but it'll be a pain if I can't develop this data stuff from the IDE > Any ideas? Would it help if I sent you the url You need to allow CORS from your web server for this to work. Hence it depends the web server you are running. Sample institutions for various web servers: https://enable-cors.org/server.html Raul |
Mon, Aug 21 2017 8:35 AM | Permanent Link |
Raul Team Elevate | On 8/21/2017 5:17 AM, Stephen Kenny wrote:
> Now I try, I can't find how to use the code debug tool, or the browser debug tool. > The browser debug tools is not currently accessible from IDE direct. Run a modern browser (i prefer Chrome), press F12 to open debug tools (or use Menu -> More Tools -> Developer Tools). With IDE running enter the app URL (it's usually shown in IDE and is normally http://localhost/<projectname>.html). There are number of useful tabs here - console tab would show CORS related errors Raul |
Mon, Aug 21 2017 9:01 AM | Permanent Link |
Stephen Kenny | Thanks for your clear explanation.
The solution I found was to put this at the top of the php <?php header("Access-Control-Allow-Headers: Authorization, Content-Type"); header("Access-Control-Allow-Origin: *"); header('content-type: application/json; charset=utf-8'); ?> Works nicely. thanks Raul wrote: On 8/21/2017 6:01 AM, Stephen Kenny wrote: > It works fine deployed, but it'll be a pain if I can't develop this data stuff from the IDE > Any ideas? Would it help if I sent you the url You need to allow CORS from your web server for this to work. Hence it depends the web server you are running. Sample institutions for various web servers: https://enable-cors.org/server.html Raul |
Mon, Aug 21 2017 9:20 AM | Permanent Link |
Matthew Jones | Stephen Kenny wrote:
> It works fine deployed, but it'll be a pain if I can't develop this data stuff from the IDE > > Any ideas? Would it help if I sent you the url? FWIW, you can use a different URL from within the IDE without a problem. So there is something wrong with your code. It might help if you post the code you are using to form the request. No need for the actual URL to be included. -- Matthew Jones |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, October 9, 2024 at 05:37 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |