Hi Peter,

Thanks for your reply. The answer is yes to all your questions.

This is the code I used:

public function init():void {
  var amfChannel:AMFChannel
      = new AMFChannel("my-amf", getContextRootUrl()
      + "/messagebroker/amf");
  amfChannel.pollingEnabled = false;
  var myChannelSet:ChannelSet = new ChannelSet();
  myChannelSet.addChannel(amfChannel);
  myService.channelSet = myChannelSet;
}

private function getContextRootUrl():String {
  var i:int = Application.application.url.lastIndexOf("/");
  var contextRootUrl:String
      = Application.application.url.substring(0, i);
  return contextRootUrl;
}

...

<mx:RemoteObject
  id="myService"
  destination="MyService"
  endpoint="{getEndpointUrl()}/messagebroker/amf"
  showBusyCursor="true"
  result="event.token.resultHandler( event )"
  fault="event.token.faultHandler( event )"
  requestTimeout="30"/>


Can you see any possible issues?

I'm still using the same services and compiler.context-root properties
for mxmlc, and I haven't amended my services-config.xml, so it still
has the following channel definition:

<channel-definition id="my-amf"
  class="mx.messaging.channels.AMFChannel">
  <endpoint
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf";
class="flex.messaging.endpoints.AMFEndpoint"/>
  <properties>
    <polling-enabled>false</polling-enabled>
  </properties>
</channel-definition>
 
Do I need to change any of this?

Cheers,

Lawrie

--- In [email protected], "Peter Farland" <[EMAIL PROTECTED]> wrote:
>
> 
> If you host your SWF inside the same WAR that hosts the remoting
> service, then you should be able to programmatically create a ChannelSet
> of Channels that is based on the URL that was used to load the SWF (at
> runtime you could look at the value of
> mx.core.Application.application.url). Did you create a ChannelSet and
> add your AMFChannel to that and then set that on your RemoteObject?
> 
>  
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of lawriegallardo
> Sent: Monday, November 19, 2007 10:46 AM
> To: [email protected]
> Subject: [flexcoders] Confused by context.root, services-config.xml and
> remoting-config.xml...
> 
> Hi,
> 
> I've got an application that uses LCDS RemoteObjects and this worked
> fine as a development build - I used the Ant mxmlc task and configured
> the services and compiler.context-root properties to point at my
> development LCDS web-app and everything was dandy.
> 
> However, when I tried to rename my web-app it stopped working... After
> some googling I discovered that using {context.root} in your
> services-config.xml and building with Flex Builder or mxmlc effectively
> hard-codes the endpoint urls for your services into your swf file.
> 
> This is an issue for me because I need to be able to do is compile my
> app once, but then be able to be able copy this app for different
> clients (i.e. each client will have a separate copy of the application
> - Client1 will access the app via www.mycomp.com/myapp/client1,
> Client2 will access the app via www.mycomp.com/myapp/client2, etc).
> 
> I've tried creating an AMFChannel in my client code and setting this as
> the channel for my mx:RemoteObjects, but this doesn't seem to work.
> I'm guessing I might also need to amend my services-config-xml file to
> get this to work???
> 
> If anyone can shed any light on this it would be greatly appreciated.
> 
> Thanks,
> 
> Lawrie
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>


Reply via email to