Hard-coded endpoint port numbers in services-config.xml
Is it possible to remove hard-coded port numbers in
services-config.xml and replace them with variables? I'd like to
deploy the same Flex application War file (including
services-config.xml within it) to our Dev, UAT and then Production
environments, for which the endpoints and port numbers must vary.
Re-building the app for each environment isn't desirable.
Has anyone else achieved this?
Maybe I can clarify what I mean. I'm assuming that basically
the same war file needs to be deployed twice to the same app
server, as in the original example, excluding changes to config
files (e.g. editing xml=ok, recompiling jars/swf=not ok).
The problem arises because if you were to change the config
file to use another port, it wouldn't make a difference to the
client app, which has the port and destination compiled in. You
would need to compile the app twice, once with the first port, once
with the second.
So my workaround is to compile (not deploy) with a config
file containing two sets of destination channels, then in your
deployed config files you remove one of the sets.
Assuming you want to deploy two instances of an app into a
single app server, there will 3 different configs, one used just to
compile, and one for each of the two deployed instances.
Config A (compilation config files, used only to compile the
flex application, not used during server start up) contains:
my-rtmp1, my-rtmp2, my-destination1, my-destination2.
Config B (server 1-debug) contains: my-rtmp1, my-destination1
Config C (server 2-release) contains: my-rtmp2,
my-destination2
So when you deploy two instances with Config B and Config C,
there is no port conflict. The Flex app then has some parameter set
in the wrapper (or the absence of said parameter could be the
indicator) to tell it whether to use my-rtmp1 or my-rtmp2.
I just tested this and it worked. The way I tested was to add
two buttons to a the Flex app, one which connects to
destination1and performs a fill, one which connections to
destination2 and performs the same operation. This Flex application
was compiled with config A.
I start a server with config B, and the application starts
fine, and the first button gets the fill as expected. The second
button instantly crashes the entire browser with an illegal memory
access exception. The second set of dest/channels aren't listening,
since the server doesn't know anything about them in it's config
file.
So on the bright side, that confirms to me that you can
compile an app with redundant channels and destinations, then
choose which destination/channel you want to use at runtime.
On the down side, being able to consistently cause a crash
like that usually isn't a good sign. I'll look again on Monday, and
raise a Flash bug if it's still present in the latest version.
Similar Messages
-
Revision: 10167
Author: [email protected]
Date: 2009-09-11 13:43:18 -0700 (Fri, 11 Sep 2009)
Log Message:
Add tests to test the enforce-endpoint-validation system setting in services-config.xml.
Modified Paths:
blazeds/trunk/qa/apps/qa-regress/testsuites/config/build.xml
Added Paths:
blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/user_classes/qa/CustomNetConnection.as
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/Remoting_NetConnectionTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/services-config.xml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/Remoting_NetConnectionTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/services-config.xmlRevision: 10167
Author: [email protected]
Date: 2009-09-11 13:43:18 -0700 (Fri, 11 Sep 2009)
Log Message:
Add tests to test the enforce-endpoint-validation system setting in services-config.xml.
Modified Paths:
blazeds/trunk/qa/apps/qa-regress/testsuites/config/build.xml
Added Paths:
blazeds/trunk/qa/apps/qa-regress/WEB-INF/flex/user_classes/qa/CustomNetConnection.as
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/Remoting_NetConnectionTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/services-config.xml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/Remoting_NetConnectionTest.mxml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/services-config.xml -
Revision: 9839
Author: [email protected]
Date: 2009-08-31 11:29:03 -0700 (Mon, 31 Aug 2009)
Log Message:
Document enforce-endpoint-validation in resources/config/services-config.xml.
Modified Paths:
blazeds/trunk/resources/config/services-config.xml -
FB3B2 services-config.xml stopped working
My App worked fine in FlexBuilder3 (Beta 1 I suppose –
yes, I'm sure it wasn't FlexBuilder2).
I upgraded to FB3B2 and I now get the compiler error:
Invalid endpoint port '' specified for channel definition
'my-amfphp'
I've attached my services-config.xml
if I take out -services "services-config.xml" from my
compiler options in flexbuilder my app compiles fine and runs
(though of course it can't retrieve data from the server).
What can I do to resolve this problem? I'm using Cairngorm
2.2.1 Beta and CairngormEnterprise 2.2.1 Beta (though I'm not sure
I really need that)Ok, this is not good at all...adding the port as I described
works great if you have the new Flash Player, but breaks the flash
remoting connection on Firefox if you have Flash Player 9.0.47.0!!!
This is not good since this is the shipping flash player and the
one that most of our customers are currently using!!!
To fix this problem for our customers I had to go back to
Flex Builder 3 Beta 1 so that I could build my product without the
port!
Is this just a "strict" compiler issue? If so, can you please
make this error go away? My app has been working without strictly
naming the port in the URL for a long time!
Thanks -
Services-config.xml for AIR application
Hello,
I am relatively new to flex. I am primarily a .net developer. I want to know how can I make a sample applicaion which uses services-config.xml
Is there a tutorial which can help me...
Any help is appriciated on this.
Regards,
PavasThe information in the compiled swf needs to match the information used at
server runtime. It basically uses the endpoint URL and perhaps a few other
tidbits from the config.
We have tokens in the URL for server, port and context root, which help the
'portability' of the swf, but if you change the MessageBroker servlet
mapping for instance, this will probably break the swf.
You *can* however, control the endpoint used by the client by using
Actionscript APIs (see the docs), but you still of course have to code that
in to the compiled application unless you prompt the user for that info.
Does that help?
Tom Jordahl
Adobe -
How to use URL in actionscript Instead of services-config.xml?
Hi Alls,
I would like to set my service's url in actionScript (I don't
want to use compiler option -services witch need to recompile swf
if you change service's url).
I search for a long time on google but I found nothing, and
adobe documentation isn't very clear.
Thank for help!!!If you are relying on a services-config.xml file, then this
must be provided
at compile time because the compiler uses it to generate
code.
If you're not using <mx:DataService>, you can actually
avoid compiling against
a services-config.xml file. This is because for the other
services, such
as <mx:RemoteObject> or <mx:WebService
useProxy="true"> or <mx:HTTPService
useProxy="true">, the main thing the compiler does from
services-config.xml
is to generate the code to instantiate the set of channels
that should be
used to contact a destination in LCDS.
Well... you can do that programmatically in ActionScript...
something like
this:
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
private function channelInit():void
var channelSet:ChannelSet = new ChannelSet();
var channel:AMFChannel = new AMFChannel(null, "
http://{server.name}:{server.port}/mycontext/messagebroker/amf");
channelSet.addChannel(channel);
myRemoteObject.channelSet = channelSet;
Just make sure you call this initialization code before you
make any service
requests. If you're proxied WebServices, be sure that you use
the ActionScript
API instead of the MXML tag so that you can delay when
loadWSDL() is called
because you'll want to setup the channelSet first.
Regards,
Pete
Hello FredFlex,
> Hi Alls,
>
> I would like to set my service's url in actionScript (I
don't want to
> use compiler option -services witch need to recompile
swf if you
> change service's url).
>
> I search for a long time on google but I found nothing,
and adobe
> documentation isn't very clear.
>
> Thank for help!!!
> -
Do I need the 'java-polling-amf in my services-config.xml if I'm using coldfusion
Do I need the 'java-polling-amf in my services-config.xml if I'm using coldfusion?
Im using IntelliJ IDEA with a flex project and for some reason its stopping comilation with this error:
[SUITE (Flex Application 1)] flex.messaging.config.ConfigurationException: The services configuration includes a channel-definition 'java-polling-amf' that has an endpoint with a context.root token but a context root has not been defined. Please specify a context-root compiler argument.
when I was using flex builder with CF builder I never needed to specify the context.rootI don't use IDEA, so I don't know what kind of configuration settings it has for Flex project development.
You don't need the java-polling-amf channel for CF development. By default, CF development uses CF-specific channels:
my-cfamf
cf-polling-amf
my-cfamf-secure
any custom channels you've created yourself for CF to use
That said, all the channels require a context root setting for your project to compile properly. If you still have Flash Builder handy, take a look at your compiler switches for a project there to see what you're missing in IDEA.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/ -
Revision: 8910
Author: [email protected]
Date: 2009-07-29 14:22:26 -0700 (Wed, 29 Jul 2009)
Log Message:
Bug: LCDS-936 - Should have better error message in servlet log if server in services-config.xml is configured to use wrong class.
QA: Yes
Doc: No
Checkintests: Pass
Ticket Links:
http://bugs.adobe.com/jira/browse/LCDS-936
Modified Paths:
blazeds/trunk/modules/core/src/flex/messaging/MessageBrokerServlet.javaAfter many hard working days.i finally found the error cause,i needed to make weblogic datasource also ADF doesnt work on internet explorer browser,it works on safary.hope it helps somebody
-
Tomcat: prefix in services-config.xml must be unique?
Hi all, I've been trying to get my flex application communicating with Tomcat and now have it working
Just trying to confirm something that took me many hours to get right and may help others along the way..
Originally I modified the BlazeDS webapp by updating the remoting xml and putting in my own classes and it worked without any problems
I then removed the BlazeDS webapp directory out the tree and created a new one carefully checking each step.. but there was nothing written to catalina log file at any time when running the app or any sign of communication even in debug mode
I then moved the sample BlazeDS webapp back and when starting Tomcat it complained of duplicate ID's (here is the message: Exception: flex.messaging.config.ConfigurationException: Can not add destination with id 'insert your remoting destination id' to service with id 'proxy-service' because another service with id 'remoting-service' already has a destination with the same id)
Eventually I noticed in services-config.xml logging section for my new webapp that the <prefix> was still set to BlazeDS - changed this to the new webapp directory name and not only did the exceptions disappear but everything now worked
So I'm thinking that the prefix is much more important than just a logging descriptor as the XML tag suggests
Can anyone confirm this behaviour or shed some light?
PS I should make clear the above problems were not when running the turnkey but on a fresh install of tomcat 6.0.29 on Centos linux using apache proxypass/reverseproxypass to redirect port 80 to 8080
PS2 - I realise this is not a pure Flex question but it's related due to Adobe crafting a turnkey Flex/Tomcat install with Blaze and it's in the flex configuration files)
I hope I've covered all bases in the question and look forward to knowing more... CHEERS!Hi all, I've been trying to get my flex application communicating with Tomcat and now have it working
Just trying to confirm something that took me many hours to get right and may help others along the way..
Originally I modified the BlazeDS webapp by updating the remoting xml and putting in my own classes and it worked without any problems
I then removed the BlazeDS webapp directory out the tree and created a new one carefully checking each step.. but there was nothing written to catalina log file at any time when running the app or any sign of communication even in debug mode
I then moved the sample BlazeDS webapp back and when starting Tomcat it complained of duplicate ID's (here is the message: Exception: flex.messaging.config.ConfigurationException: Can not add destination with id 'insert your remoting destination id' to service with id 'proxy-service' because another service with id 'remoting-service' already has a destination with the same id)
Eventually I noticed in services-config.xml logging section for my new webapp that the <prefix> was still set to BlazeDS - changed this to the new webapp directory name and not only did the exceptions disappear but everything now worked
So I'm thinking that the prefix is much more important than just a logging descriptor as the XML tag suggests
Can anyone confirm this behaviour or shed some light?
PS I should make clear the above problems were not when running the turnkey but on a fresh install of tomcat 6.0.29 on Centos linux using apache proxypass/reverseproxypass to redirect port 80 to 8080
PS2 - I realise this is not a pure Flex question but it's related due to Adobe crafting a turnkey Flex/Tomcat install with Blaze and it's in the flex configuration files)
I hope I've covered all bases in the question and look forward to knowing more... CHEERS! -
Services-config.xml REALLY necessary?
Could somebody please clarify why we need the
"services-config.xml" file when running in the context of Flex
3/AMFPHP?
As near as I can tell, "services-config.xml" MIGHT be a
requirement for running with LiveCycle Data Services, but while I'm
admittedly new at all this, it seems to me to be completely
unnecessary or even detrimental when running with Flex 3 and
AMFPHP. Using the "services-config.xml" file requires that it
compiled into the project which pretty much makes it fixed at run
time. By expressing it programmatically at run time (using AS and
the appropriate property of the RemoteObject; "endpoint" I think it
is...), you open the possibility of being able to read the
appropriate URL from an INI file or something, very handy if you
are installing your SWF on different servers with potentially
different directory structures.
Could somebody please clarify this for me?
And would somebody PLEASE put up a good Flex 3, Flex Builder
3, AMFPHP set of tutorials/examples? Considering how important
accessing backend data is, you would think such examples would be
common as dirt, but they're not. All I can find are a bunch of Flex
2 examples, and the occasional Flex 3 example INSISTS on using
"services-config.xml".
Thanks in advance.Ah I see they've included it in a seperate file:
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
</adapters>
<default-channels>
<channel ref="my-cfamf"/>
</default-channels>
<destination id="ColdFusion">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service> -
How this services-config.xml works?
I going through some gettingstarted examples of using flex with AMFPHP I got it working. But to be honest, I don’t understand this services-config.xml file
Given:
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service id="remoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://localhost/amfphp/gateway.php"
class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
</channels>
</services-config>
The only info from that file i use in my RemoteObject is this destination atttribut:
<mx:RemoteObject destination="amfphp" …/>
But what I don’t understand way they split the services-tag from channels-tag and most important how do they relate? Could somebody explain this or hint me to some easy to understand tutorial?
I tried to read adobe livedocs on Using RPC Components etc but it is so confusing, to be honest i don’t understand a word of it. what exacly is service-tag and channel-tag and whay i have to use both of them- i mean one will never switch my amfphp endpoint at runtime, will one? And way?
(ok, that destination has channel ref which reference the “other” channel-tag which points to my amfphp-gateway -but so what? what does it mean, way so commplicated - Wouldn’t it be easier if one would jut give the endpoint attribute to the RemoteObject and everything is fine?)
Thankful for any helpMaybe this will help?
http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/page001.php -
No services-config.xml file
What is the process that installs this file on my server? I
dont have this file in my web directoryare you running flex data services, or just using the Flex
SDK? If you are just using the SDK (or Flex Builder) than you don't
need to have the file on your server. It just needs to be available
during compile-time.
If you are using ColdFusion keep reading...
I included a ColdFusion services-config.xml file below. You
would just need to replace [INSERT YOUR URL] with your actual CF
server URL. You could copy this file locally to your MXML
components and include the path in the compiler options using the
-services "c:\fullpath\to\services-config.xml"
compiler switch.
**** SERVICES-CONFIG.XML *****
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service id="coldfusion-flashremoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="cf-object"
class="coldfusion.flash.messaging.ColdFusionAdapter"
default="true"/>
</adapters>
<destination id="ColdFusion">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>*</source>
<!-- define the resolution rules and access level of the
cfc being invoked -->
<access>
<!-- Use the ColdFusion mappings to find CFCs, by default
only CFC files under your webroot can be found. -->
<use-mappings>false</use-mappings>
<!-- allow "public and remote" or just "remote" methods
to be invoked -->
<method-access-level>remote</method-access-level>
</access>
<property-case>
<!-- cfc property names -->
<force-cfc-lowercase>false</force-cfc-lowercase>
<!-- Query column names -->
<force-query-lowercase>false</force-query-lowercase>
<!-- struct keys -->
<force-struct-lowercase>false</force-struct-lowercase>
</property-case>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-cfamf"
class="mx.messaging.channels.AMFChannel">
<endpoint uri="
http://[INSERT YOUR URL]/flex2gateway/"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
<serialization>
<instantiate-types>false</instantiate-types>
</serialization>
</properties>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget"
level="Error">
<properties>
<prefix>[Flex] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
<pattern>Message.*</pattern>
</filters>
</target>
</logging>
<system>
</system>
</services-config> -
Services-config.xml documentation?
Hello -
I'm getting a bit frustrated, not being able to find any complete documentation for services-config.xml and related config files (remoting-config.xml, messaging-config.xml, etc). Anyone know where I can find that? All I can find are various blog posts that gloss over lots of details. If it's in the Flex 4 docs, I sure haven't found it.
Thanks in advance.
CoryThanks for the reply. I had incorrectly thought that the
proxy was an embedded/transparent entity within the AIR engine. I
had set the endpoint URI to be the webservice, not the URI of a
some kind of AMF proxy.
My initial goal was to be able to set HTTP Authentication
Headers, as in 'Authentication: Basic ...'. I'd be a bad engineer
if I set up a proxy just so that I could use
AbstractWebService.set[Remote]Credentials(). My first attempt at
not using a proxy was to do:
var ws:WebService = new WebService();
ws.useProxy = false;
ws.wsdl = '...';
ws.endpointURI = '...';
var header:URLRequestHeader =
new URLRequestHeader("Authentication", "Basic ...");
ws.httpHeaders = header;
The header was being ignored however. The documentation
available to me isn't doing much to tell me if httpHeaders:Object
wanted a URLRequestHeader or just a string, or just a name:value
pair object ... none of them seem to make a difference. Is the
httpHeaders parameter only used in the useProxy=true setting?
Thanks again for the help. Any more help in pushing me in the
right direction toward doing HTTP Authenticated SOAP communication
would be greatly appreciated. -
Does it actualy matter what you have on your remote server for services-config.xml
Hi there, does it actualy matter what you have on your remote server for services-config.xml ?
Does the information not just get baked into the flex 3 app at compile time on my local computer?I don't think this is right!
If you don't have any config file, you can set up a remote object. The config file handles the default settings.
If you implement something like
<mx:RemoteObject id="myService"
destination="amf"
source="remoteServiceName"
endpoint="http://myDomain/amfphp/gateway.php"
fault="handleFault(event)">
<mx:method name="test" result="handleResult(event)"/>
</mx:RemoteObject>
it will work!
Dany -
Revision: 3867
Author: [email protected]
Date: 2008-10-24 07:13:10 -0700 (Fri, 24 Oct 2008)
Log Message:
Add new user-agent info to the sample services-config.xml file.
Modified Paths:
blazeds/trunk/resources/config/services-config.xmlResolved! The problem was in the php code the wizard had generated as an example and that I had edited in Dreamweaver. I had tried to start a session and set session objects in the php code. I developed if() { statements} to check the session variable before executing the function in some of my data services. Apparently the wizard does not like this. I removed all references to session. I reconfigured the input types and the return types for each service. With the code now clean the wizard created the example code and placed the proper package in the scr.services package. I still have custom php code and it executes.
Things I learned:
If the php code stops when a session variable is not available in the if statement and the data service is refreshed, the wizard will not "look" beyond the if statement.
Functions downstream of a session variable misshap will show in the data services window but the functions will have a circle icon to the left of the function name and each variable to be passed to the php code will be declared as type = Object in Flashbuilder. The input types and return types will have to be reconfigured for each non-functioning function. Simply commenting out a portion of the php code and attempting a refresh will not make it work again.
When the wizard is unable to refresh properly because of a stop in the php code it stops working completely so additional refreshes or creation of code is not carried out.
I decided to create a My SQL table for user and other identifiers rather than attempting the session object again.
Sorry, I did not make screen shots as I solved this problem. I hope the solution is not hard to visualize.
Thanks for looking and considering how to help me. I hope my solution works for you.
Maybe you are looking for
-
Photoshop CC 2014 for Mac Keeps Crashing on Startup!
Running latest version of OS X Mavericks 10.9.3, PS CC 2014, all plugins are updated as of TODAY and all worked FINE after installation. Program seems very hit or miss with successive bouts of starting fine then crashing, etc. Here is the crash log:
-
What do I do after I intall the Windows 7 disc. and I do not have the Mac installation disc to complete the set up?
-
SSRS report design for local processing mode
I use SSRS, SQLSERVER 2012 and VS2012. Does anyone know whether there is a way to design the report without going through the report wizard or attaching using the binding source objects that you drag and drop and the datasets that you drag and drop e
-
When I touched my iphone there was a static shock
When I touched my ipone there was a static shock & the back light came on & is staying on even when I powered down. Is there a way to shut it off?
-
ECC to MDM initial load config
Hi, for initial load of master data using MDMGX for lookup tables and for main table do we need to do any configuration on ECC to run these transactions? Jeff