简体   繁体   English

如何使用JavaScript调用sharepoint Web服务?

[英]how can i call sharepoint webservice using javascript?

Trying to call sharepoint web service using javascript . 尝试使用javascript调用sharepoint Web服务。 it's throwing error not able to call sharepoint service . 它引发错误,无法调用sharepoint服务。 if i call local XML then working fine . 如果我调用本地XML,则工作正常。 I tried below code for calling sharepoint webservice 我尝试了下面的代码来调用Sharepoint Web服务

    if (window.XMLHttpRequest)

          {// code for IE7+, Firefox, Chrome, Opera, Safari
              xmlhttp=new XMLHttpRequest();
          }

        else
          {// code for IE6, IE5

               alert(xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"));
          }

        xmlhttp.open("GET","http://#######_n/listdata.svc",true,"#####","#####");
         xmlhttp.setRequestHeader( 'Content-Type','application/json');
         xmlhttp.send();
         xmlDoc=xmlhttp.responseXML;

I am passing username and password for Authenticate URL . 我正在传递用于身份验证URL的用户名和密码。 but not able to get data . 但无法获取数据。

So could you tell me some idea for my problem , how can i access sharepoint webservice . 因此,您能告诉我一些问题的想法吗,我该如何访问sharepoint Webservice。 which method is correct for getting all details from .svc . 哪种方法对从.svc获取所有详细信息是正确的。 Its very important for me now 现在对我来说非常重要

Advance thanks :) 预先感谢:)

Here is a nice walk through: http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx 这是一个不错的演练: http : //weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx

I'd also recommend that you also take a look at a tool like Fiddler that can watch the traffic between your browser and the server. 我还建议您还看看Fiddler之类的工具,该工具可以监视浏览器和服务器之间的流量。 This can be a great help in figuring out all sorts of problems that might crop up while you are developing. 这对于解决开发过程中可能出现的各种问题可能是一个很大的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM