locked
use webservices calls on crm forms onload event RRS feed

  • Question

  • Hi,

    I added code on appointment form in CRM 3.0 to call web service that take CRM parameters value and add to external SQL db.it was working good and when upgrade to CRM 4 ita raises error

    ---------------------------
    Message from webpage
    ---------------------------
    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.   at System.Xml.XmlTextReaderImpl.Throw(Exception e)   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()   at System.Xml.XmlTextReaderImpl.Read()   at System.Xml.XmlTextReader.Read()   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read()   at System.Xml.XmlReader.MoveToContent()   at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToContent()   at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement()   at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()   at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)   at System.Web.Services.Protocols.SoapServerProtocol.Initialize()   at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)   at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)   --- End of inner exception stack trace ---</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
    ---------------------------
    OK  
    ---------------------------

    attached the code that raise the error :

    var AStart=crmForm.all.actualstart.DataValue;
    var AEnd=crmForm.all.actualend.DataValue;
    var Amin=crmForm.all.actualdurationminutes.DataValue;
    var statuscode=crmForm.all.statuscode.DataValue;
    var actualstart=crmForm.all.scheduledstart.DataValue;
    var status=crmForm.all.statecode.DataValue;
    var actualend=crmForm.all. scheduledend.DataValue;
    var actualdurationminutes=crmForm.all.actualdurationminutes.DataValue;
    var scheduledstart=crmForm.all.scheduledstart.DataValue;
    var scheduledend=crmForm.all.scheduledend.DataValue;
    var location=crmForm.all.location.DataValue;
    var allday=false;
    var description=crmForm.all.description.DataValue;
    var Optional='';
    var Opt=crmForm.all.optionalattendees.DataValue;
       for (key in Opt)
    {
    Optional=Optional+","+  Opt[key].name;
    }

    var Req='';
    var Required=crmForm.all.requiredattendees.DataValue;
       for (key in Required)
    {
    Req=Req+","+  Required[key].name;
    }

    var query="actualstart="+actualstart+"&actualend="+actualend+"&actualdurationminutes=" +actualdurationminutes+"&location="+location+"&status="+status+"&Amin="+Amin+"&AStart="+AStart+"&AEnd="+AEnd+"&Optional="+Optional+"&Req="+Req+"&Notes="+description;

    var url1 ='http://ServerName/WFIntegration/service.asmx/AddOrder';
    if(status==1)
    {
    var xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
    xmlhttp.open("POST", url1, false);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send(query);
    alert(xmlhttp.responseText.replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>","").replace("<string xmlns=\"http://tempuri.org/\">","").replace("</string>",""));

    }
    else
    {

    };

     

    please help I spend more than 10 hours searching for this erro.


    mano_meee
    Sunday, December 5, 2010 3:55 PM

Answers