JavaScript Cross-Origin Request Blocked error when calling remote service

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).

chrome:
XMLHttpRequest cannot load http://xx.xx.xx.xx:9000/json?1489011528395. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:88’ is therefore not allowed access.

This is service calling javacript code:

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

Hello

Did you enable CORS support on the server side? It is disabled by default.

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);

and in DataAbstract4_intf.js

// Service: SimpleLoginService
__namespace.SimpleLoginService = function SimpleLoginService(__channel, __message, __service_name) {
RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
this.fServiceName = this.fServiceName || __service_name || “SimpleLoginService”;
};

__namespace.SimpleLoginService.prototype = new __namespace.BaseLoginService();

this is my js includes
< script type=“text/javascript” src=“RemObjectsSDK.js”>< /script>
< script type=“text/javascript” src=“DataAbstract.js”>< /script>
< script type=“text/javascript” src=“DataAbstract4_intf.js”>< /script>
< script type=“text/javascript” src=“MySvc_intf.js”>< /script>

Hello

Seems there is an issue with the JS codegen.

You need to fix your Intf.js file. Your services there are defined like

__namespace.DataService.prototype = new __namespace.DataAbstractService();

You need to change their definitions by explicitly defining the prototype namespace:

__namespace.DataService.prototype = new RemObjects.DataAbstract.Server.DataAbstractService();

This should resolve the issue.

Sorry for inconvenience

Thanks, logged as bugs://77380

bugs://77380 got closed with status notfixable.

Logged as bugs://i65101.

bugs://i65101 was closed as fixed.