You need to sign in to do that
Don't have an account?
SaurabhRawane
Ajax Proxy Error
Hi All,
I have been working on Ajax proxy example to get data on to salesforce by making a call to external WebService.
By Envelope variable looks likes this:
var envelope='<?xml version="1.0" encoding="utf-8"?>'+
+'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+
+'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
+'<soap:Body>'+
+'<GetWeatherByPlaceName xmlns="http://www.webservicex.net">'+
+'<PlaceName>'+c1+'</PlaceName>'+
+'</GetWeatherByPlaceName></soap:Body>'+
+'</soap:Envelope>';
And remote function looks like this:
sforce.connection.remoteFunction({
url : "http://www.webservicex.net/soap",
requestHeaders: {
"Content-Type": "text/xml",
"SOAPAction": "\"\""
},
mimeType: "text/xml",
requestData: envelope,
method: "POST",
onSuccess : function(response) {
alert(response+'Test');
document.getElementById("result").value = response.textContent;
},
onFailure : function(response) {
document.getElementById("result").value = "Failed " + response.textContent;
}
}
);
I have been not getting any response using the above method,i have also made entry for the proxy in Salesforce,can anyone help me regarding this,or suggest some methods to track where i am facing problem.
I have been working on Ajax proxy example to get data on to salesforce by making a call to external WebService.
By Envelope variable looks likes this:
var envelope='<?xml version="1.0" encoding="utf-8"?>'+
+'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+
+'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
+'<soap:Body>'+
+'<GetWeatherByPlaceName xmlns="http://www.webservicex.net">'+
+'<PlaceName>'+c1+'</PlaceName>'+
+'</GetWeatherByPlaceName></soap:Body>'+
+'</soap:Envelope>';
And remote function looks like this:
sforce.connection.remoteFunction({
url : "http://www.webservicex.net/soap",
requestHeaders: {
"Content-Type": "text/xml",
"SOAPAction": "\"\""
},
mimeType: "text/xml",
requestData: envelope,
method: "POST",
onSuccess : function(response) {
alert(response+'Test');
document.getElementById("result").value = response.textContent;
},
onFailure : function(response) {
document.getElementById("result").value = "Failed " + response.textContent;
}
}
);
I have been not getting any response using the above method,i have also made entry for the proxy in Salesforce,can anyone help me regarding this,or suggest some methods to track where i am facing problem.
Otherwise your code looks good.