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 6347273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:10:55+00:00 2026-05-24T21:10:55+00:00

I’m trying to call a simple web service like this, on the client side:

  • 0

I’m trying to call a simple web service like this, on the client side:

$.ajax({
    type: "POST",
    url: "/service/local/newsservice.asmx/DoPost", // "/news/post/do",
    data: {
        title: _title,
        markdown: _markdown,
        categoryId: 1
    },
    success: function (data) {
        alert("success!");
    }
});

The actual service is:

[WebService(Namespace = "http://service.site.com/service/news")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class NewsService : System.Web.Services.WebService
{
    [WebMethod]
    [ScriptMethod]
    public static void DoPost(string title, string markdown, int categoryId)
    {
        if (!(Roles.IsUserInRole("Owner") || Roles.IsUserInRole("Administrator")))
            return;

        CommunityNews.Post(title, markdown, categoryId);
    }
}

When using the rewritten URL, which points to "/service/local/newsservice.asmx/DoPost", I get the following error:

The HTTP verb POST used to access path
‘/service/local/newsservice.asmx/DoPost’ is not allowed.

When I use the plain URL, I get this instead (via Firebug, the application silently fails):

DoPost Web Service method name is not valid.

What could be going on?

  • 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-05-24T21:10:55+00:00Added an answer on May 24, 2026 at 9:10 pm

    The built-in way of calling a web service in ASP.NET is to use a service reference, which creates JavaScript objects for you to call your web service methods.

    ServiceReference Class

    To call Web service methods from ECMAScript (JavaScript), you must
    include a service reference in the ASP.NET page and apply the
    ScriptServiceAttribute attribute to the Web service class definition.
    If you include a service reference to a Web service in the
    ScriptManager or ScriptManagerProxy control inside the ASP.NET page,
    JavaScript objects will be instantiated in the browser.

    The proxy objects will be used to do the following:

    • Make asynchronous requests in JavaScript to Web service methods,

    • Initialize instances of proxies of server data types, in
      particular for use as input parameters for invoking Web methods.

    Since you’re using jQuery instead of the proxy objects created for ASP.NET AJAX, you might have to check a couple things are configured properly:

    Exposing Web Services to Client Script

    To enable Web service calls from [ASP.NET AJAX] script, you must register the
    ScriptHandlerFactory HTTP handler in the application’s Web.config
    file. The handler processes calls made from script to .asmx Web
    services. The following example shows the Web.config element for
    adding the handler.

    These configuration settings are already part of the Web.config file
    template for any new AJAX-enabled Web sites that you create in
    Microsoft Visual Studio 2005.

    <system.web>   
      <httpHandlers>
        <remove verb="*" path="*.asmx"/> 
        <add verb="*" path="*.asmx" 
          type="System.Web.Script.Services.ScriptHandlerFactory"
          validate="false"/>   
      </httpHandlers> 
    <system.web>
    

    For Web service calls that are not issued from ASP.NET AJAX script,
    the ScriptHandlerFactory handler delegates the call to the default
    handler, which uses SOAP instead of JSON format. The delegation is
    performed automatically and you do not have to take any action unless
    you want to disable the use of the SOAP protocol for the Web services.
    In that case, you must enter the following configuration setting in
    the Web.config file.

    <system.web>   
      <webServices>
        <protocols>
          <clear/>
        </protocols>   
      </webServices> 
    </system.web>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.