Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 46. Introduction to RPC Services > Debugging Remote Service Calls - Pg. 845

Chapter 46: Introduction to RPC Services if (ws == null) { ws = new mx.rpc.soap.WebService(); ws.addEventListener(FaultEvent.FAULT, onWebServiceFault); ws.ItemSearch.addEventListener(ResultEvent.RESULT, onAmazonSearchResult); ws.ItemSearch.resultFormat="xml"; ws.loadWSDL("http://webservices.amazon.com/AWSECommerceService.wsdl"); } Bind the fault and result event handlers to the onWebServiceFault and onAmazonSearchResult handler used in the preceding example. Set the resultFormat , which unlike the HTTPService , can only have the values xml , e4x , or object . Next, using explicit parameter passing, create the object hierarchy representing the proper WSDL defi- nition for ItemSearchResult that was shown above. When the WebService is called, Flex will encode the object into a proper SOAP request, intelligently mapping the ActionScript objects defined here into a valid schema SOAP envelope for delivery to the remote server: /Use explicit parameter passing in Actionscript var shared:Object = {SearchIndex: "Books", Keywords: "Professional Adobe Flex 3", Count: 25 }; var request:Object = new Object(); request.AWSAccessKeyId = "YOUR_ACCESS_KEY_HERE"; request.Shared = shared;