- 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 | |
Example |
|
Request |
|
Response | myWebService.login.lastResult |
Parameters |
|
Advantage(s) |
|
Disadvantage(s) |
|
Generated Web Service Proxy Class | |
Example | <search:OracleSearchService id="myWebService"> <search:login_request_var> <search:Login_request> <search:username>{tiNameInput.text}</search:username> <search:password>{tiPassInput.text}</search:password> </search:Login_request> </search:login_request_var> </search:OracleSearchService> |
Request | myWebService.login_send() |
Response | myWebService.login_lastResult |
Parameters | Strongly typed objects (i.e., Login_request class instance). |
Advantage(s) |
|
Disadvantage(s) |
|
Notes
- 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).
No comments:
Post a Comment