• mscrm4.0 用js调用Webservice


    var ORG_NAME="xteam";
    function retrieve(entityName,entityId,attributeName){
        
    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\">" + 
        
    "  <soap:Header>" + 
        
    "    <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
        
    "      <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>" + 
        
    "      <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">"+ORG_NAME+"</OrganizationName>" + 
        
    "      <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>" + 
        
    "    </CrmAuthenticationToken>" + 
        
    "  </soap:Header>" + 
        
    "  <soap:Body>" + 
        
    "    <Retrieve xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
        
    "      <entityName>"+entityName+"</entityName>" + 
        
    "      <id>"+entityId+"</id>" + 
        
    "      <columnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:ColumnSet\">" + 
        
    "        <q1:Attributes>" + 
        
    "          <q1:Attribute>"+attributeName+"</q1:Attribute>" + 
        
    "        </q1:Attributes>" + 
        
    "      </columnSet>" + 
        
    "    </Retrieve>" + 
        
    "  </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/Retrieve");
        xmlHttpRequest.setRequestHeader(
    "Content-Type""text/xml; charset=utf-8");
        xmlHttpRequest.setRequestHeader(
    "Content-Length", xml.length);
        xmlHttpRequest.send(xml);
        
    var resultXml = xmlHttpRequest.responseXML;
        
    return resultXml;
    }

    var resultXml= retrieve("systemuser","a37eeb60-54ae-df11-97a3-00155d612b04","fullname");

    alert(resultXml.xml);
  • 相关阅读:
    $.data(elem, key, val) 和 elem.data(key, val)
    支付宝调起,应用签名失败,请联系商家
    关于load方法加载时间问题
    你学过的每一样东西,你遭受的每一次苦难,都会在你一生中的某个时候派上用场。 ——佩内洛普·菲兹杰拉德 《离岸》
    iOS视图生命周期总结(别人博客荡来的)
    闲言(诗三百三首)
    iOS 点击WebView中的链接,跳转指定控制器
    IOS 版本号大小比较
    iOS二维码,条形码扫描问题
    IOS使用个推遇到的坑
  • 原文地址:https://www.cnblogs.com/seerlin/p/1979471.html
Copyright © 2020-2023  润新知