using AS or <mx:WebService> tag
For <mx:WebService> tag, specify id, url of the wsdl file and optionally fault handler function. You can trap an event called load that fires when WSDL loads successfully
You can use methods on a Web Service in three ways:
1.Undeclared Method: Use WS with id. Flex looks at WSDL for the method based on how it is called
2.Declared Method: Operations defined as children of WS tag using <mx:operation> tag. Args validated using WSDL
3.Fully Declared Method: Both operations and arguments declared using <mx:operation> and <mx:request> tag.
Declaring operations enables specifying event handlers for each operation
<mx:WebService id="myWebservice"
wsdl="http://myWsdlUrl/myWsdlFile.wsdl"
fault= handleFaultFunc(event)>
<mx:operation name="funcNameInWsdl" result="resultHandlingFunc(event)">
<mx:request>
<paramName1InWsdl> {asVar1ToPickInputFrom} </paramName1InWsdl>
<paramName2InWsdl> {asVar2ToPickInputFrom} </paramName2InWsdl>
</mx:request>
</mx:operation>
</mx:WebService>
Then to call the operation
myWebservice.funcNameInWsdl.send();
To do in AS:
var myWebservice:WebService = new WebService();
myWebservice.wsdl =
"http://myWsdlUrl/myWsdlFile.wsdl";
ws.loadWSDL(); /*Before calling any method we need to load wsdl. Use canLoadWSDL() to check if WSDL was loaded or not*/
ws.addEventListener("result", resultHandlingFunc);
ws.addEventListener("fault", handleFaultFunc);
ws.funcNameInWsdl(asVar1ToPickInputFrom, asVar2ToPickInputFrom);
Becoming a Freelancer as a Finance Professional
5 years ago
No comments:
Post a Comment