Is there some sort of configuration settings in FlashBuilder 4.5 where you can easily switch between webservice urls? Right now I have to delete and recreate the web service every time I switch from local to production and vice versa.
-
That doesn't make sense. Is this a problem with your web service? Or with your Flex application? Your web service should be architected in such a way that it can easily move between web servers; and if you need to re-create it every time you deploy your Flex app something is wrong. How is the web service created? How are you accessing it in the Flex app – JeffryHouser Sep 29 '11 at 00:53
-
We have a webservice on qa and production. When testing we use the qa environment, so I use the data services wizard to hook up to that service, but when I deploy for production I then need to recreate the service and vice versa when going back to qa. – chobo Sep 29 '11 at 16:55
-
Please check this [http://stackoverflow.com/questions/7205634/changing-wsdl-of-flex-4-5-autogenerated-service-proxy-classes/7773594#7773594][1] [1]: http://stackoverflow.com/questions/7205634/changing-wsdl-of-flex-4-5-autogenerated-service-proxy-classes/7773594#7773594 – 4ur3 Oct 14 '11 at 21:18
-
Please check this [changin wsdl of flex 4.5][1] [1]: http://stackoverflow.com/questions/7205634/changing-wsdl-of-flex-4-5-autogenerated-service-proxy-classes/7773594#7773594 – 4ur3 Oct 14 '11 at 21:21
-
Please check this [here][1] [1]: http://stackoverflow.com/questions/7205634/changing-wsdl-of-flex-4-5-autogenerated-service-proxy-classes/7773594#7773594 – 4ur3 Oct 14 '11 at 21:24
2 Answers
The need/requirement is this – Since I work in a startup, we keep changing servers, and their IP addresses. And being a service oriented application – I need to be able to edit the webservice endpoints in my Flex application in a easy manner every time this happens.
My Solution for this -
Assumption is that my webservice endpoint looks like this -
http:////ListAllServices/
1) Create a file config.xml in a folder named “settings” that sits in the root folder of your Flex application – outside the “src” folder. And the config.xml will be a simple xml file of the following format -
localhostTestFlexApp
At the end of this exercise the directory structure of your flex source code will look like this -
flex_src(root of the source code) -com(some source folder) –testapp —view — -images -settings –config.xml -appName.mxml
2) Now in your application code, setup a HTTPService object either in mxml or action script. Set the url of that object to this value- “settings/config.xml” – And the above xml fiel containing the current settings will be loaded into memory .
Now you can store these values in a singleton object and construct your Webservice call at runtime.
And whenever you want to move this to a new server in production, edit the tag of your config.xml and you should be good to go.
And this can be automated as well via the EnvGen ant task.
This is not the best way but yes it is very helpful while switching among servers.

- 1,863
- 3
- 19
- 40
-
Hi Swati, I am used the data services wizard to setup a web services that points to a wsdl. The wizard generates a whole bunch of class files with all the settings. I have tried changing the wsdl parameter is a subclass but it had no affect. Would your technique work in conjunction with using the data wizard? – chobo Sep 30 '11 at 18:23
-
i didn't tried this by using data services wizard but i think this will work you just need to set the wsdl parameter path in the config.xml file.Hope this will work. – Swati Singh Oct 03 '11 at 04:18
Alrighty... The way I was doing it before in fact worked. The problem was browser caching.
For the benefit of others I modified the subsclass for the generated service and replace the wsdl variable with whatever endpoint I need.

- 31,561
- 38
- 123
- 191