connecting to remote webservice using SOAP and WSDL using flex or actionscript
The requirement is to get the method named getIncidentList() from web service using Soap and wsdl using Flex or Actionscript. Can anyone help me i have a code which is not working:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:WebService id="DirectoryService"
wsdl="http://cmuicds.rutgers.edu/uicds/core/ws/services/DirectoryService.wsdl"
useProxy="false"
showBusyCursor="true"
result="onResult(event)"
fault="onFault(event)">
</mx:WebService>
<mx:ApplicationControlBar dock="true">
<mx:Button id="button"
label="get incidents from web service"
click="button_click()"/>
<mx:ComboBox id="cmb" dataProvider="{zipfls}" labelField="name" width="241" height="24"/>
</mx:ApplicationControlBar>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.collections.ArrayCollection;
[Bindable] private var zipfls:ArrayCo开发者_高级运维llection;
private var flag:Boolean;
private function button_click():void
{
//Alert.show("Hi");
//DirectoryService.GetIncidentList.send();
DirectoryService.GetIncidentList();
flag = DirectoryService.canLoadWSDL();
//flag = DirectoryService.hasOwnProperty();
//Alert.show("Testing....." + flag);
//Alert.show("Description " +DirectoryService.operations);
}
private function onResult(evt:ResultEvent):void
{
zipfls = new ArrayCollection();
//textArea.text = ObjectUtil.toString(evt.result);
zipfls = evt.result as ArrayCollection;
Alert.show("Is data comming in?" + zipfls.length);
}
private function onFault(evt:FaultEvent):void
{
Alert.show(evt.type);
}
]]>
</mx:Script>
</mx:Application>
I think you are not calling method properly
and event button_click should be
private function button_click():void
{
DirectoryService.GetIncidentList();
}
i.e. send should not be used.
also see Using WebService components
Hopes that helps
精彩评论