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 servername.company.com 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 (http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx)

    var soapEnv =
    "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
        <soapenv:Body> \
            <GetListCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
            </GetListCollection> \
        </soapenv:Body> \

        url: "http://devsp2:3050/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        contentType: "text/xml; charset=\"utf-8\""
  • Have you setup an alternate access mapping for devsp2? Commented May 3, 2012 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
    Commented May 3, 2012 at 20:31
  • Are you able to get there in a browser (The site, not the web service)? Commented May 3, 2012 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
    Commented May 3, 2012 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
    Commented May 4, 2012 at 1:36

1 Answer 1


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.

  • 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
    Commented May 8, 2012 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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