ASP.NET Web Method that accepts a List is failing with “Web Service method name is not valid.”

后端 未结 10 790
感动是毒
感动是毒 2020-12-10 07:25

I want to create a web method that accepts a List of custom objects (passed in via jQuery/JSON).

When I run the website locally everything seems to work. jQuery an

10条回答
  •  情歌与酒
    2020-12-10 07:37

    Since the error mentions a problem with the web method name, I suspect this is entirely due to problems in how the WSDL is generated and mapped to the web service. I see two potential problems:

    1. ID is an awfully common name and may be reserved or may cause conflicts. Try renaming it to objectId (capitalized parameter names are not the norm for .NET anyway)
    2. WSDL does not have a concept of generic types. Depending on the generator, the type name generated for List or CustomObject[] may conflict with your parameter name CustomObjectList. Try renaming your second parameter customObjects instead.

    Or maybe there's some other silly framework issues at play here. In any case, you should add to your question the WSDL generated by .NET. You can get the WSDL XML by downloading /manageobjects.asmx?WSDL from your web server.

提交回复
热议问题