- Use Flex built-in WebService class
- Use web service proxy classes (automatically generated by WSDL Instrospection Wizard)
Flex Built-in WebService Class
The <mx:WebService> tag gives you access to the operations of SOAP-compliant web services deployed on a web server.
See a working example here.
Web Service Proxy Classes
You can use the Flex Builder "Import Web Service" feature to automatically generate connection code for invoking SOAP-based web service operations. The generated code includes client-side (ActionScript) web service proxy classes that return strongly typed objects. You can use the generated code to call web service operations directly and to pass strongly typed objects as operation parameters. See the details on Adobe Flex 3 Help.
The following two tables compare these two approaches:
|Flex WebService Class|
|Generated Web Service Proxy Class|
|Parameters||Strongly typed objects (i.e., Login_request class instance).|
- Based on WSDL's schema definition, WSDL introspection wizard generates a set of web service proxy classes in advance. At runtime, operation's parameters are provided as strongly-typed objects (i.e., content objects) and marshaled/validated to SOAP message body.
- The mappings between the WSDL definition and the MXML Web services declaration depend on the operation style (Document or RPC), encoding mechanism used (literal or encoded), type (simple or complex) of parameter, and number of parameters. (You can read "Develop Web services clients with Macromedia Flex" article to understand the mapping issues although it is a little bit out-of-date).