
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
111
if (application.myStream){
application.myStream.syncWrite = true;
application.myStream.record();
application.myStream.send("test", "hello world");
}
WebService class
Availability
Flash Media Server 2
Description
You can use the WebService class to create and access a WSDL/SOAP web service. Several classes comprise the Flash
Media Interactive 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.
Create and access a web service:
1
Load the WebServices class:
load("webservices/WebServices.asc");
2 Prepare the WSDL location:
var wsdlURI = "http://www.flash-db.com/services/ws/companyInfo.wsdl";
3 Instantiate the web service object by using the WSDL location:
stockService = new WebService(wsdlURI);
4 (Optional) Handle the WSDL parsing and web service instantiation event through the WebService.onLoad()
handler:
// Handle the WSDL loading event.
stockService.onLoad = function(wsdl){
wsdlField.text = wsdl;
}
5 (Optional) If the WSDL doesn’t load, handle the fault:
// If the WSDL fails to load, the onFault event is fired.
stockService.onFault = function(fault){
wsdlField.text = fault.faultstring;
}
6 (Optional) Set the SOAP headers:
// If headers are required, they are added as follows:
var myHeader = new XML(headerSource);
stockService.addHeader(myHeader);
7 Invoke a web service operation:
// Method invocations return an asynchronous callback.
callback = stockService.doCompanyInfo("anyuser", "anypassword", "ADBE");
// NOTE: callback is undefined if the service itself is not created
Commenti su questo manuale