Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

XmlHttp Response return is null value

$
0
0

Hi,

 My Requirement :   In Online MSCRM 2016  there is a Custom entity .We have a custom button  in Ribbon in this entity once clicks on this button call the external web service  but HttpResponse  return type is null

I am able to send the XmlHttprequest  to the External web-service  properly But XmlHttpResponse is return is null value 

Could you please help me out this problem

function callFedExTrackWebService() {
var FedexTrackingNumber = Xrm.Page.getAttribute("new_trackno").getValue();
var FactoryShipdate = Xrm.Page.getAttribute("new_factoryshipdate").getValue();
var fedexaccdetails_Key = "";
var fedexaccdetails_Password = "";//"fSWp1JvlXO3GWqhjsqjEHi9NU";
var fedexaccdetails_AccountNumber = "";
var fedexaccdetails_MeterNumber = ";;

var specialChars = '&|^|@|.|*|,|';


if (FactoryShipdate != null) {
//if (FedexTrackingNumber != '' && FedexTrackingNumber.length >= 7 && isNumeric(FedexTrackingNumber))
//{
//var url = fedexaccdetails_URL;
//var xml = "<?xml version="1.0" encoding="utf-8"?>" +
//"<soap:Envelope xmlns:soap="schemas.xmlsoap.org/.../envelope" xmlns:xsi="www.w3.org/.../XMLSchema-instance&rdquo; xmlns:xsd=”www.w3.org/.../XMLSchema">" + GenerateAuthenticationHeader() +
// "<soap:Body>" +

var xmlhead = '<?xml version="1.0" encoding="utf-8"?>';

var soapEnv = '<soapenv:Envelope xmlns:soapenv=\"schemas.xmlsoap.org/.../envelope\" xmlns:v9=\"http://.com/ws/track/v9\"><soapenv:Header/>';

var soapbdy = '<soapenv:Body><v9:TrackRequest>';
var wad = '<v9:WebAuthenticationDetail><v9:UserCredential><v9:Key>' + fedexaccdetails_Key + '</v9:Key><v9:Password>' + fedexaccdetails_Password + '</v9:Password></v9:UserCredential></v9:WebAuthenticationDetail>';
var cd = '<v9:ClientDetail><v9:AccountNumber>' + fedexaccdetails_AccountNumber + '</v9:AccountNumber><v9:MeterNumber>' + fedexaccdetails_MeterNumber + '</v9:MeterNumber><v9:Localization><v9:LanguageCode>EN</v9:LanguageCode><v9:LocaleCode>US</v9:LocaleCode></v9:Localization></v9:ClientDetail>';


var td = '<v9:TransactionDetail><v9:CustomerTransactionId/><v9:Localization><v9:LanguageCode>EN</v9:LanguageCode><v9:LocaleCode>US</v9:LocaleCode></v9:Localization></v9:TransactionDetail>';
var ver = '<v9:Version><v9:ServiceId>trck</v9:ServiceId><v9:Major>9</v9:Major><v9:Intermediate>0</v9:Intermediate><v9:Minor>0</v9:Minor></v9:Version>';

var sd = '<v9:SelectionDetails><v9:PackageIdentifier><v9:Type>TRACKING_NUMBER_OR_DOORTAG</v9:Type><v9:Value>' + FedexTrackingNumber + '</v9:Value></v9:PackageIdentifier></v9:SelectionDetails><v9:ProcessingOptions>INCLUDE_DETAILED_SCANS</v9:ProcessingOptions>';
var soapEnd = '</v9:TrackRequest></soapenv:Body></soapenv:Envelope>';
var soapXML = xmlhead + soapEnv + soapbdy + wad + cd + td + ver + sd + soapEnd;


var xmlhttp = null;

try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
try {
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert("XMLHTTP Not Supported On Your Browser");

}
}
}
}



xmlhttp.open("POST", "ws.test.com/web-services", true);
debugger;
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done. use firebug/console to see network response');
}
}
}

xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(soapXML);
var resultXml = xmlhttp.responseXML;
console.log(resultXml);
alert(resultXml);

var fedExIdTrackingNumber = resultXml1.selectSingleNode("//q1:" + columns).attributes["new_fedexotheridtrackingnumberuniqueid"].text;
var fedexShiptimestamp = resultXml1.selectSingleNode("//q1:" + columns).attributes["new_fedexshiptimestamp"].text;
var Fedexstatusdetailcode = resultXml1.selectSingleNode("//q1:" + columns).attributes["new_fedexstatusdetailcode"].text;
var fedexstatusdetail = resultXml1.selectSingleNode("//q1:" + columns).attributes["new_fedexstatusdetail"].text;
var FedExtherIDPackageIDtype = resultXml1.selectSingleNode("//q1:" + columns).attributes["new_fedexotheridpackageidtype"].text;


}
}

function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>