Hi,
I have problem when calling remote service from my local web app (tested on apache http://localhost:88/ro/index.html and directly opened in browser)
I get error in browsers developer tools console
firefox:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://xx.xx.xx.xx:9000/json?1489010484704. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
function getServerDateTime(){
var Channel = new RemObjects.SDK.HTTPClientChannel(“http://x.x.x.x:9000/json”);
var Message = new RemObjects.SDK.JSONMessage();
var Svc = new MyService(Channel, Message);
Svc.GetServerDateTime(function(result) {
alert("res " + result);
},
function(msg) {
alert("err " + msg.getErrorMessage())
}
);
}
In firefox I got answer from remote service:
{“version”:“1.1”,“id”:"{CB7B0941-0F97-4FA8-BE8B-7E44DDA4F1D1}",“result”:{“Result”:“2017-03-08T23:08:03.785”}}
And chrome doesn’t get response from service
Thank you Anton! This has solved my problem with CORS.
I have another problem with my service test. When html file is loaded it throws error in dev tools console:
TypeError: __namespace.SimpleLoginService is not a constructor[Learn More] MySvc_intf.js:266:38
error line in generated MySvc_intf.js
__namespace.LoginService.prototype = new __namespace.SimpleLoginService();
I see that there are SimpleLoginService references and definitions in:
DataAbstract.js
case 2: //userID, password
svc = new RemObjects.DataAbstract.Server.SimpleLoginService(this.fLoginService);