Companywebcast API Wiki
Navigation
Cwc API Home
PlayerSDK
Meta Service
Getting Started
Creating a client
Methods
Data Types
Understanding Webcast security
Management Service
Getting Started
Creating a client
Methods
Data Types
Quick Search
Advanced Search »
Back
History
MetaService 1.0 : Creating a Flex Client
((( Important note:{BR} Do not create a browser based clients that contain your Webcast Management System username and password. If you are looking to implement something like this, please request a new account specifically for the MetaService at [Lars.Jilesen@companywebcast.com]. ))) Adobe's Flex has good support for consuming webservices through it's built in WebService Component. Flex's Eclipse based IDE has a feature that will let you generate proxy classes, but at the time of writing this feature seems to fail on importing WSDL files that contain any type of SecurityPolicy parameters. It may be possible to manually remove the Security parameters from the WSDL file, and use this modified file to create the proxy classes. The sample code below does not follow this method, instead it uses the WebService Component's feature that will let you manually format the request messages. While debugging these "in browser" type clients, it's very usefull to monitor their web traffic with tools like HttpFox and Fiddler. Note that Fiddler requires a little bit more fiddling before it will let you look at SSL traffic. <code XML> <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:WebService makeObjectsBindable="true" result="ProcessResult(event)" id="ws" wsdl="https://services.companywebcast.com/meta/metaservice.svc?wsdl" fault="SoapFault(event)" useProxy="false"> <mx:operation name="WebcastGet" resultFormat="object"> <mx:request> <Username> {this.Username} </Username> <Password> {this.Password} </Password> <Code > {this.SelectedWebcastCode} </Code > <Language> {this.SelecteWebcastLanguage} </Language> </mx:request> </mx:operation> <mx:operation name="WebcastSearch" resultFormat="object"> <mx:request> <Username> {this.Username} </Username> <Password> {this.Password} </Password> <OwnerName> {this.OwnerName.text} </OwnerName> <TopicTitle> {this.TopicTitle.text} </TopicTitle> <SpeakerLastName> {this.SpeakerLastName.text} </SpeakerLastName> <WebcastTitle> {this.WebcastTitle.text} </WebcastTitle> <PeriodFrom> {this.PeriodFrom.selectedDate} </PeriodFrom> <PeriodTo> {this.PeriodTo.selectedDate} </PeriodTo> <Status> {this.Status.selectedItem} </Status> <PageNumber> 0 </PageNumber> <PageSize> 100 </PageSize> </mx:request> </mx:operation> </mx:WebService> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.controls.Alert; [Bindable] private var Username:String = "testusername"; [Bindable] private var Password:String = "testpassword"; [Bindable] private var SelectedWebcastCode:String; [Bindable] private var SelecteWebcastLanguage:String; [Bindable] private var CurrentWebcastGet:Object; [Bindable] private var CurrentWebcastSearch:Object; // Handles Soap errors from the WebService Component public function SoapFault(error:Object):void { Alert.show(error.fault.faultString,"Error"); } // Handles incoming messages from the MetaService public function ProcessResult(result:Object):void { if (CurrentWebcastGet != ws.WebcastGet.lastResult) { CurrentWebcastGet = ws.WebcastGet.lastResult; } if (CurrentWebcastSearch != ws.WebcastSearch.lastResult) { CurrentWebcastSearch = ws.WebcastSearch.lastResult; } } // Fires when the selected webcast in the List Component changes public function SelectedWebcastChange(event:Object):void { SelectedWebcastCode = event.itemRenderer.data.Code; SelecteWebcastLanguage = event.itemRenderer.data.Languages[0]; ws.WebcastGet.send() } public function DoSearch():void { ws.WebcastSearch.send() } // Called by the List Component while databinding, returns the string to display private function TopicsLabelFunction(Topic:Object):String { return Topic.Title; } ]]> </mx:Script> <mx:Panel title="MetaService Flex Client" height="556" width="75%" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"> <mx:HDividedBox width="100%" height="100%" liveDragging="true"> <mx:Form label="Credentials"> <mx:FormItem label="PeriodFrom"> <mx:DateField id="PeriodFrom"/> </mx:FormItem> <mx:FormItem label="PeriodTo"> <mx:DateField id="PeriodTo"/> </mx:FormItem> <mx:FormItem label="OwnerName"> <mx:TextInput id="OwnerName"/> </mx:FormItem> <mx:FormItem label="WebcastTitle"> <mx:TextInput id="WebcastTitle"/> </mx:FormItem> <mx:FormItem label="SpeakerLastName"> <mx:TextInput id="SpeakerLastName"/> </mx:FormItem> <mx:FormItem label="TopicTitle"> <mx:TextInput id="TopicTitle"/> </mx:FormItem> <mx:FormItem label="Status"> <mx:ComboBox id="Status"></mx:ComboBox> </mx:FormItem> <mx:FormItem> <mx:Button label="WebcastSearch" click="DoSearch()"/> </mx:FormItem> </mx:Form> <mx:VDividedBox height="100%" liveDragging="true"> <mx:DataGrid dataProvider="{this.CurrentWebcastSearch.WebcastSummaries}" change="SelectedWebcastChange(event)"> <mx:columns> <mx:DataGridColumn headerText="Code" dataField="Code"/> <mx:DataGridColumn headerText="Languages" dataField="Languages"/> <mx:DataGridColumn headerText="OwnerName" dataField="OwnerName"/> <mx:DataGridColumn headerText="PlannedStart" dataField="PlannedStart"/> <mx:DataGridColumn headerText="Status" dataField="Status"/> <mx:DataGridColumn headerText="Title" dataField="Title"/> </mx:columns> </mx:DataGrid> <mx:List labelFunction="TopicsLabelFunction" dataProvider="{this.CurrentWebcastGet.Webcast.Topics}"></mx:List> </mx:VDividedBox> </mx:HDividedBox> </mx:Panel> </mx:Application> </code>