Here is my WebService
[WebService(Namespace = "http://www.rpsoft.com.vn/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public partial class DataFeeder : System.Web.Services.WebService
{
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public object[] GetMatrixChallenge()
{
string challenge = "123";
rsl.Add(MatrixChallenge);
rsl.Add("");
return rsl.ToArray();
}
And here is my js using jquery 1.4.3
ServerProxy.GetMatrixChallenge = function(onSuccess, onError, isAsync)
{
$.ajax({
type: "POST",
url: "DataFeeder.asmx/GetMatrixChallenge",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: isAsync != undefined? isAsync : true,
success: onSuccess,
error: onError != undefined? onError : this.DefaultOnError,
});
}
When call webserive, the return is, and DefaultOnError was called
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.rpsoft.com.vn/">
<anyType xsi:type="xsd:string">5D1A3B</anyType>
<anyType xsi:type="xsd:string">abc</anyType>
</ArrayOfAnyType>
I thinks the format is wrong. Where is my mistake? I am using VS2005, ASP.Net 2.0, IIS7 on Windows7 I have tried to add
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
The code run well on Windows 2003 but can not run on Window7.