Expand my Community achievements bar.

Data Services access when the SWF is served from somewhere else

Avatar

Level 1
Is it possible to serve a flex swf outside of the Data
Services appserver that can access the dataservices
Producer/Consumer mx tags?



If so, how would you add the remote URL to the mx:Consumer or
mx:Producer to access the data services?
3 Replies

Avatar

Level 2
Yes, this is possible. You may compile your swfs ahead of
time and then deploy them on any web server. When compiled
correctly, these swfs should be able to connect to your FDS server
back-end.



When you compile your swfs with the command-line compiler,
you'll need to make sure you specify -services
<location_of_services_config_xml> as part of the compiler
options. If you services-config.xml file has {context.root} or
{context-root} tokens, you'll also need to specify -context-root
/flex where /flex is the context root for your web application. If
you have hard-coded server names and ports, be sure that these
match the configuration of your FDS server so that the remote swf
will know which FDS endpoints to connect to.



In some cases, you'll also need to include a crossdomain.xml
file allowing access to the FDS server.

Avatar

Level 1
Does anybody have any actual code lines and compiler line
examples they can give to make this type of configuration work ?

Everything runs fine if the swf is on the same server as FDS.
I want the FDS server on its own machine, so

I tried the posted suggestion of including the

-services '
http://www.servername.com:8700/flex/WEB-INF/flex/services-config.xml'
in the Flex Builder 2 compiler setting and it

just keeps saying "unable to open
http://www.servername.com:8700/flex/WEB-INF/flex/services-config.xml.



And yes, I also tried it with and without the -context-root
/flex flag just in case.



TIA

Avatar

Level 1
I figured this out by trial and error, and there's probably
some others trying to do this, so I thought I would post it.



1. In the compiler settings, instead of -services <url of
server with location of services-config.xml> , make it -services
<location of LOCAL services-config.xml, this means that you
would have to have FDS running locally as well which makes sense
for testing.



2. In your LOCAL services-config.xml, change the
{server-name} entries to www.yourFDSserver.com for each of the
Channels that you are using.



3. Recompile the swf and place it on the webserver of your
choice.



4. You may need to place a crossdomain.xml file for security
access.