Difference between specifying remoteObject in mxml and in actionscript ?

View: New views
4 Messages — Rating Filter:   Alert me  

Difference between specifying remoteObject in mxml and in actionscript ?

by Jim Hayes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sure I'm missing something here, but It would be good if anyone
could point out exactly what it is!

I'm attempting to configure a remoteObject *without* the compiler option
of    -services \\someServer\Path\WEB-INF\flex\services-config.xml or
similar

I initally thought it would be a question of merely specifying an
endpoint, so I started off with this in my actionscript class :

_remoteObj = new RemoteObject();
_remoteObj.makeObjectsBindable = true;
_remoteObj.destination = "fluorine";
_remoteObj.source = "ppRemoteService";
// add the endpoint, all the code above works fine with the compiler -
services option
_remoteObj.endpoint = "http://localhost/ppBackend/Gateway.aspx";

Which errors out at runtime with :

"Cannot assign operations into an RPC Service (endpoint)"

Yet, if I define the service in my main Application mxml in what looks
to me like identical parameters , like this :

<mx:RemoteObject id="testRemoteMxml"
                        makeObjectsBindable="true"
                        destination="fluorine"
                        source="ppRemoteService"
       
endpoint="http://localhost/ppBackend/Gateway.aspx" />

then just use  _remoteObj = Application.application.testRemoteMxml into
my actionScript class (apologies for bad form there)

it works just fine.

This is in flexbuilder 3.0 with the default "Flex 3" SDK, I should
mention.

So what am I missing? A timing / initialisation error would be my first
thought, but if so then I can't see quite how.

I'm probably just being a bit stupid, anyone got any ideas or relevant
experience?

Many thanks,

Jim.

(p.s. I notice that there is no autocomplete suggestion in flexbuilder
for remoteObjectInstance.endpoint in actionScript yet it compiles fine.
This is probably a clue that I'm doing something wrong, I would say. If
only I knew what it was!)

______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
______________________________________________________________________

RE: Difference between specifying remoteObject in mxml and in actionscript ?

by Jeff Vroom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the problem here is that mx.rpc.remoting.RemoteObject does not support the "endpoint" property whereas mx.rpc.remoting.mxml.RemoteObject does.     I believe endpoint was originally intended just to be a simple alternative to defining the ChannelSet and so not supported universally but we are thinking of just moving endpoint up to the base RemoteObject tag since it is so commonly used.

If you use the mxml variant from AS you'll also need to use the mxml operation.  The other option is to just add this chunk of code to your AS version and avoid use of the endpoint property:


    /**
     *@private
     */
    mx_internal function initEndpoint():void
    {
        if (endpoint != null)
        {
            var chan:Channel;
            if (endpoint.indexOf("https") == 0)
            {
                chan = new SecureAMFChannel(null, endpoint);
            }
            else
            {
                chan = new AMFChannel(null, endpoint);
            }
            channelSet = new ChannelSet();
            channelSet.addChannel(chan);
        }
    }

Jeff

From: flexcoders@... [mailto:flexcoders@...] On Behalf Of Jim Hayes
Sent: Friday, August 15, 2008 7:23 AM
To: flexcoders@...
Subject: [flexcoders] Difference between specifying remoteObject in mxml and in actionscript ?


I'm sure I'm missing something here, but It would be good if anyone
could point out exactly what it is!

I'm attempting to configure a remoteObject *without* the compiler option
of -services \\someServer\Path\WEB-INF\flex\services-config.xml or
similar

I initally thought it would be a question of merely specifying an
endpoint, so I started off with this in my actionscript class :

_remoteObj = new RemoteObject();
_remoteObj.makeObjectsBindable = true;
_remoteObj.destination = "fluorine";
_remoteObj.source = "ppRemoteService";
// add the endpoint, all the code above works fine with the compiler -
services option
_remoteObj.endpoint = "http://localhost/ppBackend/Gateway.aspx";

Which errors out at runtime with :

"Cannot assign operations into an RPC Service (endpoint)"

Yet, if I define the service in my main Application mxml in what looks
to me like identical parameters , like this :

<mx:RemoteObject id="testRemoteMxml"
makeObjectsBindable="true"
destination="fluorine"
source="ppRemoteService"

endpoint="http://localhost/ppBackend/Gateway.aspx" />

then just use _remoteObj = Application.application.testRemoteMxml into
my actionScript class (apologies for bad form there)

it works just fine.

This is in flexbuilder 3.0 with the default "Flex 3" SDK, I should
mention.

So what am I missing? A timing / initialisation error would be my first
thought, but if so then I can't see quite how.

I'm probably just being a bit stupid, anyone got any ideas or relevant
experience?

Many thanks,

Jim.

(p.s. I notice that there is no autocomplete suggestion in flexbuilder
for remoteObjectInstance.endpoint in actionScript yet it compiles fine.
This is probably a clue that I'm doing something wrong, I would say. If
only I knew what it was!)

__________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
__________________________________________________________


 
 

image001.jpg (486 bytes) Download Attachment
image002.jpg (456 bytes) Download Attachment

RE: Difference between specifying remoteObject in mxml and in actionscript ?

by Jim Hayes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Many Thanks Jeff, a big help and much appreciated!

I was having a bit of a tired Friday afternoon mental block there...


-----Original Message-----
From: flexcoders@... on behalf of Jeff Vroom
Sent: Fri 15/08/2008 16:56
To: flexcoders@...
Subject: RE: [flexcoders] Difference between specifying remoteObject in mxml and in actionscript ?
 
I think the problem here is that mx.rpc.remoting.RemoteObject does not support the "endpoint" property whereas mx.rpc.remoting.mxml.RemoteObject does.     I believe endpoint was originally intended just to be a simple alternative to defining the ChannelSet and so not supported universally but we are thinking of just moving endpoint up to the base RemoteObject tag since it is so commonly used.

If you use the mxml variant from AS you'll also need to use the mxml operation.  The other option is to just add this chunk of code to your AS version and avoid use of the endpoint property:


    /**
     *@private
     */
    mx_internal function initEndpoint():void
    {
        if (endpoint != null)
        {
            var chan:Channel;
            if (endpoint.indexOf("https") == 0)
            {
                chan = new SecureAMFChannel(null, endpoint);
            }
            else
            {
                chan = new AMFChannel(null, endpoint);
            }
            channelSet = new ChannelSet();
            channelSet.addChannel(chan);
        }
    }

Jeff

From: flexcoders@... [mailto:flexcoders@...] On Behalf Of Jim Hayes
Sent: Friday, August 15, 2008 7:23 AM
To: flexcoders@...
Subject: [flexcoders] Difference between specifying remoteObject in mxml and in actionscript ?


I'm sure I'm missing something here, but It would be good if anyone
could point out exactly what it is!

I'm attempting to configure a remoteObject *without* the compiler option
of -services \\someServer\Path\WEB-INF\flex\services-config.xml or
similar

I initally thought it would be a question of merely specifying an
endpoint, so I started off with this in my actionscript class :

_remoteObj = new RemoteObject();
_remoteObj.makeObjectsBindable = true;
_remoteObj.destination = "fluorine";
_remoteObj.source = "ppRemoteService";
// add the endpoint, all the code above works fine with the compiler -
services option
_remoteObj.endpoint = "http://localhost/ppBackend/Gateway.aspx";

Which errors out at runtime with :

"Cannot assign operations into an RPC Service (endpoint)"

Yet, if I define the service in my main Application mxml in what looks
to me like identical parameters , like this :

<mx:RemoteObject id="testRemoteMxml"
makeObjectsBindable="true"
destination="fluorine"
source="ppRemoteService"

endpoint="http://localhost/ppBackend/Gateway.aspx" />

then just use _remoteObj = Application.application.testRemoteMxml into
my actionScript class (apologies for bad form there)

it works just fine.

This is in flexbuilder 3.0 with the default "Flex 3" SDK, I should
mention.

So what am I missing? A timing / initialisation error would be my first
thought, but if so then I can't see quite how.

I'm probably just being a bit stupid, anyone got any ideas or relevant
experience?

Many thanks,

Jim.

(p.s. I notice that there is no autocomplete suggestion in flexbuilder
for remoteObjectInstance.endpoint in actionScript yet it compiles fine.
This is probably a clue that I'm doing something wrong, I would say. If
only I knew what it was!)

__________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
__________________________________________________________



______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
______________________________________________________________________
 

winmail.dat (8K) Download Attachment

Re: Difference between specifying remoteObject in mxml and in actionscript ?

by valdhor-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You may find this thread useful:

http://tech.groups.yahoo.com/group/flexcoders/message/120115


--- In flexcoders@..., "Jim Hayes" <jim@...> wrote:

>
> I'm sure I'm missing something here, but It would be good if anyone
> could point out exactly what it is!
>
> I'm attempting to configure a remoteObject *without* the compiler option
> of    -services \\someServer\Path\WEB-INF\flex\services-config.xml or
> similar
>
> I initally thought it would be a question of merely specifying an
> endpoint, so I started off with this in my actionscript class :
>
> _remoteObj = new RemoteObject();
> _remoteObj.makeObjectsBindable = true;
> _remoteObj.destination = "fluorine";
> _remoteObj.source = "ppRemoteService";
> // add the endpoint, all the code above works fine with the compiler -
> services option
> _remoteObj.endpoint = "http://localhost/ppBackend/Gateway.aspx";
>
> Which errors out at runtime with :
>
> "Cannot assign operations into an RPC Service (endpoint)"
>
> Yet, if I define the service in my main Application mxml in what looks
> to me like identical parameters , like this :
>
> <mx:RemoteObject id="testRemoteMxml"
> makeObjectsBindable="true"
> destination="fluorine"
> source="ppRemoteService"
>
> endpoint="http://localhost/ppBackend/Gateway.aspx" />
>
> then just use  _remoteObj = Application.application.testRemoteMxml into
> my actionScript class (apologies for bad form there)
>
> it works just fine.
>
> This is in flexbuilder 3.0 with the default "Flex 3" SDK, I should
> mention.
>
> So what am I missing? A timing / initialisation error would be my first
> thought, but if so then I can't see quite how.
>
> I'm probably just being a bit stupid, anyone got any ideas or relevant
> experience?
>
> Many thanks,
>
> Jim.
>
> (p.s. I notice that there is no autocomplete suggestion in flexbuilder
> for remoteObjectInstance.endpoint in actionScript yet it compiles fine.
> This is probably a clue that I'm doing something wrong, I would say. If
> only I knew what it was!)
>
> ______________________________________________________________________
> This communication is from Primal Pictures Ltd., a company
registered in England and Wales with registration No. 02622298 and
registered office: 4th Floor, Tennyson House, 159-165 Great Portland
Street, London, W1W 5PA, UK. VAT registration No. 648874577.
>
> This e-mail is confidential and may be privileged. It may be read,
copied and used only by the intended recipient. If you have received
it in error, please contact the sender immediately by return e-mail or
by telephoning +44(0)20 7637 1010. Please then delete the e-mail and
do not disclose its contents to any person.
> This email has been scanned for Primal Pictures by the MessageLabs
Email Security System.
> ______________________________________________________________________
>