none
SOAP javascript webservice xml 编写 RRS feed

  • 问题

  •  var xml = "" +
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
    "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
    GenerateAuthenticationHeader() +
    " <soap:Body>" +
    "  <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
    "   <Request xsi:type=\"RetrieveEntityRequest\">" +
    "    <LogicalName>opportunity</LogicalName>" +
    "    <EntityFilters>Relationships</EntityFilters>" +
    "   </Request>" +
    "  </Execute>" +
    " </soap:Body>" +
    "</soap:Envelope>" +
    "";
    
      var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    
      xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
      xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");
      xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
      xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
      xmlHttpRequest.onreadystatechange = function () {
        if (xmlHttpRequest.readyState == 4) {
          if (xmlHttpRequest.status == 200) {
                //<c:OneToManyRelationships>
            var node = xmlHttpRequest.responseXML.selectSingleNode("//c:OneToManyRelationships");
                debugger;
              }
              else {
                alert(xmlHttpRequest.responseXML);
                debugger;
              }
            }
      }
      xmlHttpRequest.send(xml);
    
    


    自定义ribbon中调用如上javascript,来获取entity的relationship,但是不晓得写的对不对,希望大家帮帮忙,报错是 server was unable to process the request...

    我看过2011 SDK的soap消息编写,之所以先说07的格式,是因为2011的写法我这还有其他的问题,太过诡异。

     


    Dude....
    2011年7月29日 9:45

全部回复