Flash Media Server |
|||
| Server-Side ActionScript Language Reference > Server-Side ActionScript Language Reference > WebService class | |||
Flash Media Server 2.
You can use the WebService class to create and access a WSDL/SOAP web service. There are several classes that comprise the Flash Media Server web services feature: WebService class, SOAPFault class, SOAPCall class, and Log class.
|
NOTE |
|
The WebService class is not able to retrieve complex data or an array returned by a web service. Also, the WebService class does not support security features. |
The following steps outline the process of creating and accessing a web service.
var wsdlURI = "http://www.flash-db.com/services/ws/companyInfo.wsdl";
stockService = new WebService(wsdlURI);
// Handle the WSDL loading event.
stockService.onLoad = function(wsdl){
wsdlField.text = wsdl;
}
// If the WSDL fails to load the onFault event is fired.
stockService.onFault = function(fault){
wsdlField.text = fault.faultstring;
}
// If headers are required they are added as follows: var myHeader = new XML(headerSource); stockService.addHeader(myHeader);
// Method invocations return an asynchronous callback.
callback = stockService.doCompanyInfo("anyuser", "anypassword", "MACR");
// NOTE: callback is undefined if the service itself is not created
// (and service.onFault is also invoked).
// Handle a successful result.
callback.onResult = function(result){
// Receive the SOAP output, which in this case
// is deserialized as a struct (ActionScript object).
stock.companyInfo = result;
}
// Handle an error result.
callback.onFault = function(fault){
// Catch the SOAP fault and handle it
// according to this app's requirements.
stock.companyInfo = fault.faultstring;
}
|
Property |
Description |
|---|---|
|
Invoked when an error occurs during WSDL parsing. |
|
|
Invoked when the web service has successfully loaded and parsed its WSDL file. |
Flash Media Server 2.
newWebService(wsdlURI)
wsdlURL A string specifying the URL of a WSDL URL.
A WebService object.
Constructor; creates a new WebService object. You must use the constructor to create a WebService object before you call any of the WebService class methods.
The following example prepares the WSDL location and passes it to the WebService constructor to create a new WebService object, stockService:
var wsdlURI = "http://www.flash-db.com/services/ws/companyInfo.wsdl"; stockService = new WebService(wsdlURI);
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/fms/2/docs/00000796.html
Comments
No screen name said on Apr 4, 2007 at 1:55 AM :