Click here to Skip to main content
15,885,025 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I'm currently facing an issue calling our own built webservice from mscrm form onload javascript event, all I get is a permission denied here is my javascript and more details, the same javascript code if I run it from a asp.net website I get my data back, I'm only getting the permissions denied error if I put this Jscript on MSCRM form. I tried with calling with a relative path like (x.y.z/WebService.asmx and /WebService.asmx)in that case I get a resource not found error. Your help is highly appreciated


JavaScript
function GetRMSBillDetails() {
           // var oDataEndpointUrl = "/WebService.asmx";

            var oDataEndpointUrl = "http://x.y.com:8082/abc.asmx";
            //var oDataEndpointUrl  = "http://x.y.com/abc/GetBillsFromRMSService";
            var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

            if (xmlHttpRequest != null) {

                var xml = "";
                xml += "";
                xml += "<soap:body xmlns:soap="#unknown">"
                xml += ""
                xml += "</soap:body>"
                xml += "";

                xmlHttpRequest.Open("POST", oDataEndpointUrl, true);
                xmlHttpRequest.setRequestHeader("SOAPAction", "https://x.y.com/xyz/GetBillsFromRMSService");
                xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
                xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
                xmlHttpRequest.send(xml);
                 alert("XML " +  xmlHttpRequest.responseXml);
                 
                }

            }
            return false;
        }
Posted
Updated 4-Oct-12 2:37am
v3

1 solution

I have found the solution for the problem, just in case if anyone needs the solution here it is. MSCRM is running under https binding type and my webservice was running under http binding type port, so I had to go to IIS on which my webservice is hosted and had to change the binding settings for the web service to run under https not http and that fixed the problem. Basically MSCRM if running on HTTPS expect the code that is running under its domain to be run on HTTPS also
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900