开发者

Jquery/C# Making a webService call errors out: cannot be serialized because it does not have a parameterless constructor

Here's my call:

CallMfttService("ServiceLayer/FieldingManager.asmx/GetUICs",null, SetUicValues);

Here's the WebMethod:

[WebMethod]
[ScriptMethod]
public List<string> GetUICs()
{
    UserManager user = new UserManager();
    var currentUser = user.GetUser(Security.FieldingToolPrincipal.Current.Identity.Name);
    List<string> uics = new List<string>();
    uics = Data.FieldingManager.SelectUicByJpm(currentUser.Organization);

    return uics;
}

I'm not exactly sure what the problem is.. I know it obviously doesn't like sending no paramters..I really don't know thou开发者_运维技巧gh.


The problem is most likely this:

Data.FieldingManager.SelectUicByJpm(currentUser.Organization);

The object you're returning, "uics", probably doesn't have a blank constructor. That is, a new with no parameters:

new UicObject();

Giving it one should fix your problem.


I found out the I need to send empty braces to the method.

CallMfttService("ServiceLayer/FieldingManager.asmx/GetUICs", "{}", SetUicValues);

the "{}" fixed the issue.. thanks for the replies


Try replacing null with new object[0] in your call:

CallMfttService("ServiceLayer/FieldingManager.asmx/GetUICs", new object[0], SetUicValues);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜