There are many ways to do this but here is one:

* Create a "singleton" class (.as) to hold your data access code and
your dataModels. 

* expose your data models as public properties 

* You can make the whole class "Bindable" or just the public properties
you want.

* Your public properties can be implemented as public vars or as
getter/setter functions depending on what you need

* In that class, instantiate a WebService.  If the url/wsdl is always
the same, go ahead and load the wsdl on initialize.

* Set up a single fault handler and a single result handler functions

* Create public methods as needed to invoke the WebService calls

* When you invoke send() on the WebService operation, it returns an
AsyncToken.

* To that dynamic object, add a string property holding the
operation/method name, and one with a "callid" string that specifies
special handling

* in the result handler, access those properties from event.call.

* Use a switch statement to route each operation call.  Normally, you
will simply assign the event.result AS whatever to the appropriate
dataModel variable.

* Anywhere you need a dataModel, get a reference to your singleton. (in
a script block in any mxml file for example)

* Directly bind your UI propeerties to the instance.dataModelVar

* Or, use ChangeWatcher() to invoke extra processing when the result
data is received.

 

Your English is excellent.

 

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Eduardo Souza
Sent: Tuesday, September 23, 2008 3:47 PM
To: [email protected]
Subject: [flexcoders] Using just one mx:WebService

 

Hello Everyone,

I'm working on a project wich uses a Web service on the server side
(SOAP1.1). Now our team is studying to develop a client app. And we're
developing an organizational software for our team by the way.

But I got a problem. When I create my MXMLs files, I need to create a
component (mx:WebService) on all of them. But I don't want that. I just
want one mx:WebService component containing all of webservice operations
and use just that to all of my MXMLs files. What I need to do?

Thanks!

(Sorry about my english. That isn't my primary language).

 

Reply via email to