Custom RemObjects Service Call

I have a RemObjects service call I am making in JavaScript. The call works fine (debugging on the server) except on the returning data.

The custom intf:

__namespace.JobService.prototype.GetJobsStockReport = function(
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetJobsStockReport");
        msg.write("Report", "JobStockReportsEnum", Report);
        msg.write("RequestDetail", "JobRequestDetails", RequestDetail);
        this.fChannel.dispatch(msg, function (__message) {
		var __result ="Result", "JobDetailArray");
        }, __error);

    } catch (e) {
        __error(msg, e);

It returns an array of JobDetail:

// Array: JobDetailArray
__namespace.JobDetailArray = function JobDetailArray() {;
  this.elementType = "JobDetail";
__namespace.JobDetailArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.JobDetailArray.prototype.constructor = __namespace.JobDetailArray;
RemObjects.SDK.RTTI["JobDetailArray"] = __namespace.JobDetailArray;

// Struct: JobDetail
__namespace.JobDetail = function JobDetail() {
this.Active = {dataType : "Boolean", value : null};
this.Address1 = {dataType : "AnsiString", value : null};
this.CatID = {dataType : "Integer", value : null};
this.CityID = {dataType : "Integer", value : null};
this.CustomerID = {dataType : "Integer", value : null};
this.CustomerName = {dataType : "AnsiString", value : null};
this.DaysInProgress = {dataType : "Double", value : null};
this.Desc = {dataType : "AnsiString", value : null};
this.ID = {dataType : "Integer", value : null};
this.ID2 = {dataType : "AnsiString", value : null};
this.ID3 = {dataType : "AnsiString", value : null};
this.ID4 = {dataType : "AnsiString", value : null};
this.LocationID = {dataType : "Integer", value : null};
this.Received = {dataType : "DateTime", value : null};
this.SiteName = {dataType : "AnsiString", value : null};
this.SourceID = {dataType : "Integer", value : null};
this.SubcatID = {dataType : "Integer", value : null};
this.SubsourceID = {dataType : "Integer", value : null};
__namespace.JobDetail.prototype = new RemObjects.SDK.ROStructType();
__namespace.JobDetail.prototype.constructor = __namespace.JobDetail;
RemObjects.SDK.RTTI["JobDetail"] = __namespace.JobDetail;

This is how I am calling it:

var getJobStockReport = () =>
var jobReport = new JobStockReportsEnum();
jobReport.value = “ActiveAll”;

var jobFetchEnum = new FetchEnum();
jobFetchEnum.value = "Active";

var jobListDeptDivLimitEnum = new JobListDeptDivLimitEnum();
jobListDeptDivLimitEnum.value = "None";

var jobListSort = new JobListSortEnum();
jobListSort.value = "None";

var jobRequestDetails = new JobRequestDetails();
jobRequestDetails.ActiveOrDeleted.value = jobFetchEnum;
jobRequestDetails.DeptDivID.value = 0;
jobRequestDetails.DeptDivLimit.value = jobListDeptDivLimitEnum;
jobRequestDetails.MaxRecordCount.value = 0;
jobRequestDetails.SortAscending.value = false;
jobRequestDetails.SortBy.value = jobListSort;
jobRequestDetails.StartRecord.value = 1;

jobService = new JobService(channel, message, "JobService"); 
	function(msg, res)


Before I can see the type I get this error:

TypeError: RemObjects.SDK.RTTI[realType] is not a constructor

I must not be handling the return value correctly. What is the correct way to access the returning value?


Please use uncompressed RemObjectsSDK.js instead a compressed one and check exactly code line the execution fails on.

Also 2 things:

I assume you have the JobServiceArray defined in the Intf, don’t you?

Why do you use a callback with 2 parameters? IIRC it should be just one instead of 2

Hi Anton,

First thing: did you mean “JobDetailArray”? I don’t have a “JobServiceArray”. I do have “JobDetailArray”. The code fails here:

Second thing: it was a mistake but did not fix the issue.

Is it possible to create a testcase? A server with a single method similar to the one being called and a JS client where this error reproduces?

So this was a bit problematic. I created what you asked for and simulated the data by creating it manually and it works. When I put real data to it…it fails. So I created a test project that I sent to support@remobject email.I had to include a full database. So my guess its related to a particular bit of data. Please have a look. Please acknowledge that you received it.


1 Like

Confirmed. Downloaded and reproduced the issue.


As it turns out the failing method returns JobDetail[], however the actual result is an array of JobDetailExtended instances.

There is a minor issue with the server itself:

The JobDetailExtended structure based on the JobDetail doesn’t introduce any new properties. Earlier a Code-First server would refuse to start with such structure definition as this was considered as an error.

As a result the JavaScript code generator is not able to handle such structure definitions (to be fixed soon). So the _Intf file generated contains code lines like

__namespace.JobDetailExtended = function JobDetailExtended() {

So RO/JS client cannot properly deserialize the JobDetailExtended structure and fails.
The fix is very simple:

Copy property definitions from the

__namespace.JobDetail = function JobDetail() {

function so the JobDetailExtended constructor would look like

// Struct: JobDetailExtended
__namespace.JobDetailExtended = function JobDetailExtended() {
    this.Active = { dataType: "Boolean", value: null };
    this.Address1 = { dataType: "AnsiString", value: null };
    this.CatID = { dataType: "Integer", value: null };
    this.CityID = { dataType: "Integer", value: null };
    this.CustomerID = { dataType: "Integer", value: null };
    this.CustomerName = { dataType: "AnsiString", value: null };
    this.DaysInProgress = { dataType: "Double", value: null };
    this.Desc = { dataType: "AnsiString", value: null };
    this.ID = { dataType: "Integer", value: null };
    this.ID2 = { dataType: "AnsiString", value: null };
    this.ID3 = { dataType: "AnsiString", value: null };
    this.ID4 = { dataType: "AnsiString", value: null };
    this.LocationID = { dataType: "Integer", value: null };
    this.Received = { dataType: "DateTime", value: null };
    this.SiteName = { dataType: "AnsiString", value: null };
    this.SourceID = { dataType: "Integer", value: null };
    this.SubcatID = { dataType: "Integer", value: null };
    this.SubsourceID = { dataType: "Integer", value: null };

This will fix the issue.

Thanks, logged as bugs://83382

bugs://83382 got closed with status fixed.