locked
Not allowing to call webservice in javascript/jquery in sharepoint designer 2007 RRS feed

  • Question

  • I am getting error for the following while calling web service.

    Javascript Error 

    var ws= new ActiveXObject("Msxml2.XMLHTTP.4.0");     -- Automation server cannot create object

    var ws= new ActiveXObject("Msxml2.XMLHTTP"); Permission denied

    jQuery  here i am using jquery-1.3.2.min.js 

     $.ajax({

                    url: wsURL,

                    type: "GET",

                    dataType: "xml",

                    data: soapEnv,

                    complete: processResult,

                    contentType: "text/xml; charset=\"utf-8\""

                });

    Error   -Object doesn't support this property or method

    Please suggest..

     

    Saturday, March 12, 2011 6:06 AM

Answers

  • I am able to call using Codeplex Spservices
    • Marked as answer by SPDesigner64 Friday, March 18, 2011 6:02 AM
    Friday, March 18, 2011 6:02 AM

All replies

  • Hi,

     

    According to your description, I am sorry that I don’t understand your error exactly, please describe more detailed. In my opinion, if you receive error “-Object doesn't support this property or method”, the type need to change “POST”. I have found useful Blogs about Calling the SharePoint Web Services with JQUERY. Please refer to:
    http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx
    You just post part of code. Here is an integrated code, please check it carefully. 

        <script language="Javascript">

        // Variables

        var xmlHttpReq = false;

        var callname = "GetListItems";

        var version = 459;

     

        function xmlhttpPost() {

          // Mozilla/Safari

          if (window.XMLHttpRequest) {

            xmlHttpReq = new XMLHttpRequest();

         }

     

        // IE

        else if (window.ActiveXObject) {

          xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

        }

     

        xmlHttpReq.open('POST', 'http://porter:1130/_vti_bin/Lists.asmx', true);

     

        //Set the Headers

        xmlHttpReq.setRequestHeader('Content-Type','text/xml');

        xmlHttpReq.setRequestHeader('SOAPAction','http://schemas.microsoft.com/sharepoint/soap/GetListItems');

     

         //When the response is available, update the response text

        xmlHttpReq.onreadystatechange = function() {

          if (xmlHttpReq.readyState == 4) {

             document.forms['main'].eBayXMLResponse.value = xmlHttpReq.responseText;

           }

        }

     

        //get the XML Request string

        xmlHttpReq.send('<?xml version="1.0" encoding="utf-8"?>'

    +'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'

    +'<soap:Body><GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/" >'

    +'<listName>www</listName>'

    +'<viewName></viewName>'

    +'<Query>'

    +'<Query xmlns="">'

    +'<Where>'

    +'<Eq><FieldRef Name="Title" />'

    +'<Value Type="Text">tt</Value>'

    +'</Eq>'

    +'</Where>'

    +'<OrderBy><FieldRef Name="Title" /></OrderBy>'

    +'</Query>'

    +'</Query>'

    +'<viewFields>'

    +'<ViewFields xmlns=""><FieldRef Name="ID" /><FieldRef Name="Title" /></ViewFields>'

    +'</viewFields><rowLimit>100</rowLimit>'

    +'<QueryOptions></QueryOptions>'

    +'</GetListItems></soap:Body></soap:Envelope>'

     

          );

     

          document.forms['main'].eBayXMLResponse.value = xmlHttpReq.responseText;

     

      }

     

      </script>

     
     
    Best regards
    David Hu

     

    Tuesday, March 15, 2011 1:17 AM
  • I am able to call using Codeplex Spservices
    • Marked as answer by SPDesigner64 Friday, March 18, 2011 6:02 AM
    Friday, March 18, 2011 6:02 AM