I am trying to utilize the Ajax Auto Complete Extender with a WCF service that is hosted in the web project. The service is reached and I have verified that results are returned with fiddler, however the text box associated with the auto complete extender is never populated.
The service contract is as follows:
[ScriptService]
[ServiceContract(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public interface ICertificateService
{
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json)]
List<string> GetCompletionList(string prefixText, int count);
}
The implementation is just returning a populated list of string.
The aspx is as follows:
<asp:TextBox runat="server" ID="aceInstructors"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender runat="server"
ID="autoCompleteInstructor"
TargetControlID="aceInstructors"
ServiceMethod="GetCompletionList"
ServicePath="../../CertificateService"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true" CompletionSetCount="5">
<Animations>
<OnShow> <HideAction Visible="true" /> </OnShow>
<OnHide> <HideAction Visible="false" /> </OnHide>
</Animations>
The route for the service is configured in Global.asax as follows:
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("CertificateService", new WebServiceHostFactory(), typeof(CertificateService)));
}
As stated before I can hot the service and I get a response in JSON format when I watch in fiddler. The following is the Raw response:
HTTP/1.1 200 OK
Server: Cassini/4.0.1.7
Date: Mon, 12 Sep 2011 16:44:16 GMT
X-AspNet-Version: 4.0.30319
Content-Length: 68
Cache-Control: private
Content-Type: application/json; charset=utf-8
Connection: Close
{"GetCompletionListResult":["Alpha","Beta","Gamma","Delta","Omega"]}
Something possibly worth noting is that if I omit the ResponseFormat from the Service contract, the reult is returned in XML Format and the text box is populated with a very long list undefined
Am I missing something basic?