Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 14 total
Thread RemObjects SDK trouble
Fri, Sep 4 2015 11:07 AMPermanent Link

Matthew Jones

The code for my RO SDK link compiled without problem. But it didn't
work. 8-)

Now, stop me if you see an obvious issue, as I've not come to anything
obvious. Chrome is crashing on me, so it is hard to work out if I'm
doing something mad. This thread may be a red herring.

Looking in the Chrome debugger, it was telling me that the
TMyBanxiaNewUser class didn't exist. So I looked, and my code was as
follows:

external TMyBanxiaNewUser = class
public
 constructor Create(chnl: THTTPClientChannel; msg: TJSONMessage;
    strServiceName: string);
 function GetServerStatus (/* params...*/): Integer;
 property fMessage: TMessage read;
end;

The RO SDK javascript defines functions such as this:

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


I therefore figured that I needed to drop the T from the class
definition. That moved me on somewhat.


But now we get to this EWB code:

   szServer := 'https://' + m_szHostAddress + '/JSON';
   FChannel := Remobjects.SDK.HTTPClientChannel.Create(szServer);
   FMessage := Remobjects.SDK.JSONMessage.Create;
   m_xNewUserService := MyBanxiaNewUser.Create(FChannel, FMessage,
         'MyBanxiaNewUser');


Which translatest to this javascript.

szserver = "https:\/\/" + $t.tfrmadminwelcome_m_szhostaddress +
"\/JSON";
  $t.tfrmadminwelcome_fchannel =
            RemObjects.SDK.HTTPClientChannel(szserver);
  $t.tfrmadminwelcome_fmessage = RemObjects.SDK.JSONMessage();
  $t.tfrmadminwelcome_m_xnewuserservice =
            new MyBanxiaNewUser($t.tfrmadminwelcome_fchannel,
            $t.tfrmadminwelcome_fmessage, "MyBanxiaNewUser");

When I step through it, before the call to assign the fchannel value it
is NULL. After, it is "undefined". And it then fails in this code in
RemObjectsSDK.js (line 153):

} else if (!RemObjects.UTIL.checkArgumentTypes(arguments,
["undefined", "undefined", "undefined"])) {
 throw new Error("ROService constructor: Incorrect arguments");

And then the exception stops the application from loading, and I'm
stuck. Anyone got any suggestions for a way forward?


(The SDK code is available at https://dev.banxia.com/RemObjectsSDK.js
and the interface code at
https://dev.banxia.com/MyBanxiaLibrary_intf.js )

--

Matthew Jones
Fri, Sep 4 2015 5:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

he RO SDK javascript defines functions such as this:

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

<< I therefore figured that I needed to drop the T from the class definition. That moved me on somewhat. >>

No, you don't need to drop the 'T'.  Just use the emit clause:

external TMyBanxiaNewUser emit '__namespace.MyBanxiaNewUser' = class
public
 constructor Create(chnl: THTTPClientChannel; msg: TJSONMessage;
    strServiceName: string);
 function GetServerStatus (/* params...*/): Integer;
 property fMessage: TMessage read;
end;

The whole __namespace thing is a little funky, but oh well.....

Are you using the same EWB1 RemObjects SDK external interface ?  If so, then you may want to update it to also use the proper namespacing in the emit clause for the various classes, instead of the EWB1 way of using weird class properties to do so.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Sep 5 2015 1:01 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

Please ignore my last answer.  I should have read the entire JS interface that RemObjects created.

They aren't using an object literal construct, so __namespace is not just an identifier, it's an actual object instance (defaults to the global window context).

So, what you'll need is this:

external TMyBanxiaNewUser emit 'MyBanxiaNewUser' = class
public
constructor Create(chnl: THTTPClientChannel; msg: TJSONMessage;
   strServiceName: string);
function GetServerStatus (/* params...*/): Integer;
property fMessage: TMessage read;
end;

However, you'll probably still run into the same issue as before.  So, to find out what's going on, I'll need you to send me your current RemObjects JS SDK files, along with your interface files.  I'll then send you back what you need in terms of an external interface.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 7 2015 3:51 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> So, to find out what's going on,

I realised after I left for the weekend that I have a fully working
version in EWB1, so I will step through that and see what happens, and
then compare. That should give me a good clue.

--

Matthew Jones
Mon, Sep 7 2015 4:04 AMPermanent Link

Matthew Jones

Matthew Jones wrote:

> Which translatest to this javascript.
>
> szserver = "https:\/\/" + $t.tfrmadminwelcome_m_szhostaddress +
> "\/JSON";
>    $t.tfrmadminwelcome_fchannel =
>              RemObjects.SDK.HTTPClientChannel(szserver);
>    $t.tfrmadminwelcome_fmessage = RemObjects.SDK.JSONMessage();
>    $t.tfrmadminwelcome_m_xnewuserservice =
>              new MyBanxiaNewUser($t.tfrmadminwelcome_fchannel,
>              $t.tfrmadminwelcome_fmessage, "MyBanxiaNewUser");


In EWB v1, this is what it outputs:

  szserver = "https:\/\/" + $t.tfrmwelcome_m_szhostaddress + "\/JSON";
  $t.tfrmwelcome_fchannel = new
RemObjects.SDK.HTTPClientChannel(szserver);
  $t.tfrmwelcome_fmessage = new RemObjects.SDK.JSONMessage();
  $t.tfrmwelcome_m_xnewuserservice = new
MyBanxiaNewUser($t.tfrmwelcome_fchannel, $t.tfrmwelcome_fmessage,
"MyBanxiaNewUser");

The key being "new". I will have to work out what I broke in the
interface code.

--

Matthew Jones
Mon, Sep 7 2015 4:33 AMPermanent Link

Matthew Jones

I have emailed Tim with the various files so that he can determine the
difference needed for EWB2. I suspect the ROSDKUtils.wbs file that has
been shared here, as it may somehow be "redefining" the RemObjects code
in a way that hides the object info somehow. Hopefully Tim can educate
us with the changes needed once Labor Day is over.

--

Matthew Jones
Wed, Sep 9 2015 11:04 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

Here's the fixed SDK unit for EWB 2.x.  I can't test it here, but it should work fine.

The issue was what I thought: the class property stuff doesn't fly anymore, and you need to use the emit clause in order to specify JS namespaces for proper constructors.

Tim Young
Elevate Software
www.elevatesoft.com



Attachments: ROSDKUtils.zip
Wed, Sep 9 2015 11:42 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Matthew,
>
> Here's the fixed SDK unit for EWB 2.x.  I can't test it here, but it
> should work fine.
>
> The issue was what I thought: the class property stuff doesn't fly
> anymore, and you need to use the emit clause in order to specify JS
> namespaces for proper constructors.

Thanks - works fine. Now got to get over the change to strtoint which
Throws an error if it fails, but that is easy - I used to do a similar
$NAN trap, so can just grab the exception.

Onwards I move, thanks.

--

Matthew Jones
Wed, Sep 9 2015 12:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Thanks - works fine. Now got to get over the change to strtoint which Throws an error if it fails, but that is easy - I used to do a similar $NAN trap, so can just grab the exception. >>

You're probably starting to get an idea of why it took a few months for just the EWB 2 compiler changes. Smile

Hopefully, you won't run into too much more that is different....

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 9 2015 12:46 PMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Hopefully, you won't run into too much more that is different....

Everything I've tripped on so far has been an improvement, and not a
show stopper at all.

--

Matthew Jones
Page 1 of 2Next Page »
Jump to Page:  1 2
Image