1 Reply Latest reply: Jan 28, 2011 5:38 AM by FBuilder RSS

    How to call a .NET wcf from flex using httpService

    learningflex Community Member

      I have a wcf service

      http://tdev/StatService.svc  and it has 4 .NET methods and all these are pure http returning in JSON/XML

       

      [OperationContract]

      [WebInvoke(ResponseFormat = WebMessageFormat.Json)]

       

      int GetAvailablePeopleJSON(string locationName);

       

      [OperationContract]

      [WebInvoke(ResponseFormat = WebMessageFormat.Json)]

       

      List<int> GetAvailablePeoplesListJSON(List<string> locations);

      [OperationContract]

      [WebInvoke(ResponseFormat = WebMessageFormat.Xml)]

       

      int GetAvailablePeopleXML(string locationName);

      [OperationContract]

      [WebInvoke(ResponseFormat = WebMessageFormat.Xml)]

       

      List<int> GetAvailablePeoplesListXML(List<string> locations);

       

      I need to call these methods from my flex application. Where do i give the methods name in httpService?, please help me with an example, this is what i am doing and i am getting an http request error. Is their an other way i can accomplisg this? Thank you

       

      <mx:HTTPService

       

      id="httpService"

      url="

      http://tdev/StatService.svc" useProxy="false" method="POST"

      resultFormat = "

      text"

      result="httpServiceResultHandler(event)" fault="httpServiceResultHandler_fault(event);"

      >

       

      <mx:request xmlns="">

       

      <locationName>{myText.text}</locationName>

       

      </mx:request>

      </mx:HTTPService>

      <mx:Button

       

      id="button1" x="75" y="388" label="Get Available People JSON" click="httpService.send();" />

      <mx:TextInput

       

      id = "myText" x="426" y="517" width="223" height="34"/>