Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General Discussion » View Thread |
Messages 1 to 10 of 20 total |
How call a webserver from same host |
Thu, Nov 15 2012 8:59 AM | Permanent Link |
pedrini.franck Axima srl | Hello I'am make a delphi webservice , with indy httpserver . This webserver send to EWB a Json get I deploy my EWB application on EWB webserver (localhost port 88) (same problem with IIS/) my delphi webserver run on (localhost port 88) When call my function http://localhost:88/CLI_LST form browser , return data , when call my function from EWB client-application // chiama clienti if Tbutton(sender).caption='CaricaClienti' then begin WSfunz:='CaricaClienti'; ServerRequest1.URL := 'http://localhost:88/CLI_LST'; ServerRequest1.Method := rmGet; ServerRequest1.Execute; end; Don't work When call my function diretly from IDE (Run F9) work Thank you |
Thu, Nov 15 2012 9:20 AM | Permanent Link |
Raul Team Elevate | I'm little confused as you seem to be referring to port 88 for ewb webserver/IIS as well as your delphi webserver?! I assume one of them is port 80 and other port 88. In that case the issue is that you're actually not on the same host from perspective of Javascript - it's the classic cross domain scripting scenario - basically javascript can only make requests to the domain it was loaded from. Your options are : 1. Allow cross-origin sharing from your web service (see also EWB general newsgroup for some posts on this - cross domain is the keyword). You need to add Access-Control-Allow-Origin basically to your web service. 2. Have your delphi web service also serve the html/js files so there is no cross domain issues. Raul On 11/15/2012 8:59 AM, pedrini.franck wrote: > Hello > I'am make a delphi webservice , with indy httpserver . > This webserver send to EWB a Json get > I deploy my EWB application on EWB webserver (localhost port 88) (same problem with IIS/) > my delphi webserver run on (localhost port 88) > > When call my function http://localhost:88/CLI_LST form browser , return data , > when call my function from EWB client-application > // chiama clienti > if Tbutton(sender).caption='CaricaClienti' then > begin > WSfunz:='CaricaClienti'; > ServerRequest1.URL := 'http://localhost:88/CLI_LST'; > ServerRequest1.Method := rmGet; > ServerRequest1.Execute; > end; > Don't work > When call my function diretly from IDE (Run F9) work > > Thank you > |
Thu, Nov 15 2012 10:32 AM | Permanent Link |
pedrini.franck Axima srl | Hello raul sorry for 80..88 I change my configurazione The DelphiWebservice now is on http:\\192.168.150.30:88 The EWBwebserver is on my localhost port 80 (my pc is 192.168.150.103) I open un firefox browser call my function http://192.168.150.30:88/CLI_LST and i riceve data I call my ewb application with firefox http://localhost/x6mobileprd.HTML see the form , click the button wich call my function ServerRequest1.URL := 'http://192.168.150.30:88/CLI_LST'; ServerRequest1.Method := rmGet; ServerRequest1.Execute; Request.ResponseContent.text is empty ??? |
Thu, Nov 15 2012 11:08 AM | Permanent Link |
Raul Team Elevate | As i said before this is classic cross domain scripting:
"192.168.150.30:88" and "192.168.150.30:80" are considered different domains from javascript perspective (it does not matter that they run on same computer and IP). If your javascript app is accessed using 192.168.150.30:80 then it can ONLY access resources from 192.168.150.30:80 by default. If you require access to resrouces (web service) on 192.168.150.30:88 then that web service must at the very least return Access-Control-Allow-Origin header. Raul On 11/15/2012 10:32 AM, pedrini.franck wrote: > > Hello raul > > sorry for 80..88 > I change my configurazione > The DelphiWebservice now is on http:\\192.168.150.30:88 > The EWBwebserver is on my localhost port 80 (my pc is 192.168.150.103) > > I open un firefox browser call my function http://192.168.150.30:88/CLI_LST > and i riceve data > > I call my ewb application with firefox http://localhost/x6mobileprd.HTML > see the form , click the button wich call my function > ServerRequest1.URL := 'http://192.168.150.30:88/CLI_LST'; > ServerRequest1.Method := rmGet; > ServerRequest1.Execute; > Request.ResponseContent.text is empty > > ??? > |
Thu, Nov 15 2012 11:37 AM | Permanent Link |
pedrini.franck Axima srl | OK , thank very much Raul |
Thu, Nov 15 2012 12:37 PM | Permanent Link |
pedrini.franck Axima srl | How i do insert this command in EWB IDE
on form1.create ? context.Response.Headers.Add("Access-Control-Allow-Origin: "+origin); |
Thu, Nov 15 2012 3:04 PM | Permanent Link |
Raul Team Elevate | > On 11/15/2012 12:37 PM, pedrini.franck wrote:> How i do insert
this command in EWB IDE > on form1.create ? > context.Response.Headers.Add("Access-Control-Allow-Origin: "+origin); Question as posed does not make sense (this are headers so they only are needed for web requests, not EWB apps). Secondly the line you're showing is for delphi (i think indy 9). You need to modify your web service (that you said you wrote in delphi) and it has to return the "Access-Control-Allow-Origin" header, not EWB app. EWB can include Origin header in the request but i think that is returned automatically. For now i suggest just add "Access-Control-Allow-Origin: *" to your header - this will basically allow any domain to access your web servie for cross domain access - later on you can limit it to specific domains. Using the "origin" value from request header as the response here would be same as allowing any domain anyways. How to send it specifically will depend on what you wrote your web service in exactly. If you're using indy10 http server then it's something like AResponseInfo.CustomHeaders.Add('Access-Control-Allow-Origin: *'); If you wrote your own module in EWB web server then ResponseHeaders.Add('Access-Control-Allow-Origin: *'); should do the same Raul |
Thu, Nov 15 2012 4:14 PM | Permanent Link |
pedrini.franck Axima srl | Excuse me, but they are my first experience with EWB, and did not understand why it worked with explorer, but not with firefox / chrome Thanks again Raul |
Thu, Nov 15 2012 4:28 PM | Permanent Link |
Raul Team Elevate | No problem - feel free to always ask.
EWB makes things look like Delphi/Pascal but underneath it's all javascript and web requests so things are often different. Tim has produced a pretty good manual for EWB and the "using server requests" i think is a good writeup on general process : http://www.elevatesoft.com/manual?action=topics&id=ewb1§ion=using_server_requests Raul On 11/15/2012 4:14 PM, pedrini.franck wrote: > Excuse me, but they are my first experience with EWB, and did not understand why it worked with explorer, but not with firefox / chrome > > Thanks again Raul > |
Fri, Nov 16 2012 5:28 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | I found exactly the same problem when I had cross site scripting to Load
data tables. It worked with IE but not with Chrome or Firefox. The reason is because IE doesn't care and just does it, but Chrome will send an "Access-Control-Allow-Origin" header before passing the actual request. This header is added automatically by Chrome because it has detected cross site scriting. I modified my web server to return a confirmation to the "Access-Control-Allow-Origin" message to confirm that it was in fact allowed, but EWB sees some kind of response to this "allow" message that is not what it was expecting and throws a data response error. I am unsure why sending a header response to confirm access control returns data to EWB, but it does appear to and this is what cause the problem. Chris Holland [Team Elevate] On 15/11/2012 21:14, pedrini.franck wrote: > Excuse me, but they are my first experience with EWB, and did not understand why it worked with explorer, but not with firefox / chrome > > Thanks again Raul > |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Sunday, December 1, 2024 at 03:59 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |