My friend Edwin Wong from the Flash Player team has created a web service example that does not use the WebServiceConnector component. Instead, it uses the WebServiceClasses available from Window > Other Panels > Common Libraries > Classes and dynamically establishes a connection to the web service by calling new WebService(). In Flash MX 2004 Professional, the easiest way to connect to a web service is to use the WebServiceConnector component like I did in the Fullasagoog example. Another way is to use Flash Remoting which I did here. Edwin's method is the third and probably hardest way to connect to a web service in Flash because it is not heavily documented. What little documentation is there lives in the Help panel under
Using Components > Components Dictionary > Web service classes
and
Using Flash > Data Integration > Data Binding > Working with data binding and web services at runtime
As the Help files state, "this WebService API is not the same as the WebServiceConnector component API."
Edwin's example sheds some more light on the WebService API. A WebService object is instantiated with
ws = new WebService(wsdlURI [, logObject]);
After that, methods or properties as defined by the WSDL can be accessed like so:
ws.someMethodFromWSDL();
ws.someParameterFromWSDL = "someValue";
The WSDL for the TemperatureService, for example, defines a getTemp() method. This method can be accessed directly via the instance of the WebService class as in
ws.getTemp(zipcode);
The advantage of ditching the WebServiceConnector component for the WebService class is a savings of 44K!
|





posted
by Vera Fleischer (