Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:20:28+00:00 2026-06-08T02:20:28+00:00

What would cause this? Error System.InvalidOperationException: UpdateProject Web Service method name is not valid.

  • 0

What would cause this?

Error System.InvalidOperationException: UpdateProject Web Service method name is not valid.

   at System.Web.Services.Protocols.HttpServerProtocol.Initialize()

   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

JavaScript Code:

                Ext.Ajax.request({
                        url: 'http://localhost/Controls/ProjectList/ProjectListService.asmx/UpdateProject',
                        params: {
                            'project': { project_id: 'a', project_number: 'b', project_name: 'c' }
                        },
                        success : function(response){
                            alert(response.responseText);
                        }, 
                        failure : function(response){
                            alert("Error " + response.responseText);
                        }
                });                         

Web Service (ProjectListService.asmx):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Xml;
using System.Data;
using System.Web.Script.Services;
using System.IO;
using System.Text;

namespace Web.Controls.ProjectList
{
    /// <summary>
    /// Summary description for WebService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class ProjectListService : System.Web.Services.WebService
    {
        [Serializable]
        public class Project
        {
            public string project_id;
            public string project_number;
            public string project_name;
        }

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json,
            UseHttpGet = false, XmlSerializeString = false)]
        public List<Project> GetProjects(string myTest, string bar)
        {
            var list = new List<Project>(new[] {
                new Project() {project_id="1", project_name="project 1", project_number="001"},
                new Project() {project_id="2", project_name= "project 2", project_number= "002" },
                new Project() {project_id="3", project_name= "project 3", project_number= "003" }
            });

            return list;
        }

        [WebMethod]
        [ScriptMethod]
        //[ScriptMethod(ResponseFormat = ResponseFormat.Json,
        //    UseHttpGet = false, XmlSerializeString = false)]
        public void UpdateProject(Project project)
        {

            string x = "";
            Project p = project;

        }
    }
}

==========================

7/20/2012 @ 10:43 update:

New Error:

Error {"Message":"Invalid JSON primitive: project.","StackTrace":"   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

JavaScript Code:

                Ext.Ajax.request({
                        url: 'http://localhost/Controls/ProjectList/ProjectListService.asmx/UpdateProject',
                    headers: { 'Content-Type': 'application/json' },
                    method: 'POST',
                    scope: this,
                        params: {
                            'project': { project_id: 'a', project_number: 'b', project_name: 'c' }
                        },
                        success : function(response){
                            alert(response.responseText);
                        }, 
                        failure : function(response){
                            alert("Error " + response.responseText);
                        }
                });  

==================================

7/20/2012 @ 2:40pm update:

Working JSON Request:

                var jsonStr = Ext.encode({ 'project_id': 'a', 'project_number': 'b', 'project_name': 'c' });

                Ext.Ajax.request({
                        url: 'http://localhost/Controls/ProjectList/ProjectListService.asmx/SaveProject',
                    method: 'POST',
                        jsonData: jsonStr,
                        success : function(response){
                            alert(response.responseText);
                        }, 
                        failure : function(response){
                            alert("Error " + response.responseText);
                        }
                });  

Web Method (so far):

(see Project object above in question)

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false, XmlSerializeString = false)]
public string SaveProject()
{         
    return "success";
}

================================

7/22/2012 @ 9:03pm update (fixed):

Changed two things. Added the “project” parameter of type “Project” for my web service. Then put the Project object properties inside of that object in my “jsonData” object.

Working JSON Request:

            //var jsonStr = Ext.encode({ 'project_id': 'a', 'project_number': 'b', 'project_name': 'c' });
            var jsonDataObject = { 'project': { 'project_id: '4', 'project_number': '004', 'project_name': 'project 4' } };

            Ext.Ajax.request({
                        url: 'http://localhost/Controls/ProjectList/ProjectListService.asmx/SaveProject',
                method: 'POST',
                        jsonData: jsonDataObject,
                        success : function(response){
                            alert(response.responseText);
                        }, 
                        failure : function(response){
                            alert("Error " + response.responseText);
                        }
            });  

Web Method (so far):

(see Project object above in question)

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false, XmlSerializeString = false)]
public string SaveProject(Project project)
{         
    return "success";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:20:30+00:00Added an answer on June 8, 2026 at 2:20 am

    Looks like the serializer doesn’t think you can have objects as properties of a JSON node.

    Couple things to try:

    • Since Project is your only arguments to the UpdateProject function, can you just pass your project as the data? params: { project_id: 'a', project_number: 'b', project_name: 'c' }
    • Instead of “params”, try using jsonData. This will also make it so that you don’t need to add the application/json header yourself, as well, and maybe the serialization will happen correctly (if the issue is on the client).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why/how does this create a seemingly infinite loop? Incorrectly, I assumed this would cause
Fluent NHibernate doesn't like this, throwing an error: {Association references unmapped class: System.String} OK
I am having trouble getting web services to work in ColdFusion. This works just
I would like to center a text element (in this case, the h2 sub-headline)
What would be the best practice for sharing localization object (in this case ResourceBundle,
So I have a Rails app (which in this case seems like it would
This would seem to be the case in Firefox 3.5+, there I can instantiate
This is what I thought would be a simple select clause, however the following
Ok guys, I know this is pretty a rare case but I really would
So I am wondering what would cause it so that all events for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.