SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to do a pretty straightforward query to the list.asmx web service and I keep getting a 401 error. I've spent a couple of hours attempting to solve it with no luck.

My jQuery Code:

        type: "POST",
        url: "http://devsp2:3050/_vti_bin/lists.asmx/GetList",
        data: '{"listName":"Site Pages"}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        xhrFields: {
            withCredentials: true

Error Details:

When I execute the code on a test page with a simple button click it prompts me to authenticate. However it asks me to authenticate to the and not the headername I passed.

Firebug returns:

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}

Fiddler returns (Raw):

HTTP/1.1 401 Unauthorized Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 SPRequestGuid: 9ed17429-0633-4bb8-82dd-fb086b86977f WWW-Authenticate: NTLM X-Powered-By: ASP.NET MicrosoftSharePointTeamServices: Date: Thu, 03 May 2012 19:43:08 GMT Content-Length: 16 Proxy-Support: Session-Based-Authentication



When I query the same web service using the same credentials with soapUI, it works great.

Attempted Solutions:

  • Registry Edits
    • BackConnectionHostNames
    • DisableLoopbackCheck
  • withCredentials in jQuery

Updated: Successful Solution

Thanks to @Mark D Anderson for pointing me in the right direction. The below code works. Credit to Jan Tielen as well (

    var soapEnv =
    "<soapenv:Envelope xmlns:soapenv=''> \
        <soapenv:Body> \
            <GetListCollection xmlns=''> \
            </GetListCollection> \
        </soapenv:Body> \

        url: "http://devsp2:3050/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        contentType: "text/xml; charset=\"utf-8\""
share|improve this question
Have you setup an alternate access mapping for devsp2? – theChrisKent May 3 '12 at 20:27
I did not on devsp2:3050 (this is my mysites web application) but I did for devsp2. I changed the public url to sprocks. – RWL01 May 3 '12 at 20:31
Are you able to get there in a browser (The site, not the web service)? – theChrisKent May 3 '12 at 20:34
Yes, I can get to devsp2:3050/_vti_bin/lists.asmx and devsp2:3050/_vti_bin/lists.asmx?op=GetList. However, when I go to devsp2:3050/_vti_bin/lists.asmx?op=GetList it doesn't allow me to test it even though I'm accessing it from the local server. – RWL01 May 3 '12 at 20:36
could be some kind of transparent proxy in play as well, or a proxy that is modifying the auth messages. I see the site is using NTLM – pigeon May 4 '12 at 1:36
up vote 2 down vote accepted

I think that the issue is that you are trying to pass JSON data to a SOAP Web Service, which expects XML. Plus, you're not passing in the SOAP envelope which is required. Take a look at SPServices for examples of how to call the SOAP Web Services.

share|improve this answer
This was the issue, thanks for help. I have other SP web services I built that take JSON without any issue so I'm going to compare the two and see what I'm doing differently. – RWL01 May 8 '12 at 13:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.