0

how would I change/specify the endpoint URL at runtime in a Flex App which communicates with PHP? I always used a services-config.xml so far.

I tried to overwrite the endpoint in the mxml Remote Object, with no success.

I also tried to add a new channel set to the Remote Object, but then I needed to define a destination somehow.

Help much appreciated.

Martin

4 Answers 4

1

I was struggling with the same issue and here's what emerged from my struggle ;)

public static function getRemoteObject(destination:String, channelName:String,
    showBusyCursor:Boolean=true):RemoteObject{
    var remoteService:RemoteObject=new RemoteObject(destination);
    var channelSet:ChannelSet=new ChannelSet();
    var amf:AMFChannel=new AMFChannel(channelName,
        "http://{server.name}:{server.port}" +
        (Application.application as Application).parameters.contextRoot +
        "/graniteamf/amf");
    channelSet.addChannel(amf);
    remoteService.channelSet=channelSet;
    remoteService.showBusyCursor=showBusyCursor;
    return remoteService;
}

So as you can see, I basically do just the things you said you've tried, with my endpoint being partially provided in flashVars at application startup.

Sign up to request clarification or add additional context in comments.

4 Comments

thx for the answer. I have the problem with the destination String. What do you set it to? I have no services-config.xml, so it always gives me an error, the messaging destination was not found. What's your destination? (How do you invoke this RemoteObject), and where do you set the source (Remote Class)?
Well, I must admit that I'm confused right now. I thought that you didn't want to use service-config.xml at compile time but I see that you don't want to use it at all and I don't know if it is even possible not to have it at the server side.
Well - I am using ZendAMF and PHP, so I am ok with using the service-config.xml file. But so far I only had it compiled into the Flex App. It was not located on the server. With this approach, do I need to put it on the server?? Have never thought of this, how/where would I put it.?
Ok. Sorry, my bad, I am myself Java developer and in case of Java it's mandatory for services-config.xml to be on the server. This way providing it at compile time is not necessary. I thought that in case of PHP it works similarly but unfortunately (as I'm reading through Zend documentation) it does not. Sorry again for speaking about something I have not the slightest idea about :(
0

I just came across this post because i'm looking for a way that does not use this services-config.xml file. Wich for deployement purpose can be a real problem and I came across this post : http://gertonscorner.wordpress.com/2008/09/06/remoteobject-using-amfphp-and-actionscript-3/

Just to help those who googled their way here ;)

Comments

0

This is the only way I could get it to work, in the generated stub for your service:

import com.adobe.fiber.core.model_internal;

Also:

    /**
 * Override super.init() to provide any initialization customization if needed.
 */
protected override function preInitializeService():void
{           
    _needWSDLLoad = false; // to prevent loading the default WSDL
    super.preInitializeService();
    // Initialization customization goes here
    wsdl = "http://localhost/yourservice?wsdl";
    _needWSDLLoad = true;
    model_internal::loadWSDLIfNecessary();  

Comments

0

as simple as amfphp style :

   gateway = new NetConnection();
   gateway.connect("http://localhost/ZServer/");
   gateway.call("MyService.getData", new Responder(getLoan, onFault));

   public function getLoan(result:Array):void {
                dpDataRaw = new ArrayCollection(result);
            }               

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.