You need to sign in to do that
Don't have an account?
user CAP Administrator
502 Bad Gateway after calling WS from community
Hi All,
We had this following error : 502 (Bad Gateway) when we tried to call a WS (soap) from community.
There is no issue if we test it in admin
here the code :
sforce.connection.remoteFunction({
url : "https://v10-creditor.cs81.force.com/creditor/services/Soap/class/WebServiceTest",//"https://" + window.location.host + "/services/Soap/class/WebServiceTest",//"https://maps.googleapis.com/maps/api/geocode/json?address=Kensington",
//mimeType: "text/xml",
cache : false,
async: false,
requestHeaders: {"Authorization":"Bearer " + __sfdcSessionId,
"Content-Type":"text/xml",
"SOAPAction": "Hello"
},
requestData: envelope.join(''),
method: "POST",
onSuccess : function(response) {
// sforce.debug.log(response);
console.log('response: ');
console.log(response);
var obj = JSON.stringify(xmlDoc);
console.log('stringify: ');
console.log(obj);
var jObj = JSON.parse(obj);
//alert("onSuccess: \n\n" + jObj);
console.log('JSON: ');
console.log(jObj);
return returnObject;
},
onFailure : function(response) {
console.log(response);
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(response,"text/xml");
//alert("onFailure end:" + xmlDoc);
return returnObject;
}
});
// Step 3: Get Response from GED WS - Khanh
return returnObject;
}
We had this following error : 502 (Bad Gateway) when we tried to call a WS (soap) from community.
There is no issue if we test it in admin
here the code :
sforce.connection.remoteFunction({
url : "https://v10-creditor.cs81.force.com/creditor/services/Soap/class/WebServiceTest",//"https://" + window.location.host + "/services/Soap/class/WebServiceTest",//"https://maps.googleapis.com/maps/api/geocode/json?address=Kensington",
//mimeType: "text/xml",
cache : false,
async: false,
requestHeaders: {"Authorization":"Bearer " + __sfdcSessionId,
"Content-Type":"text/xml",
"SOAPAction": "Hello"
},
requestData: envelope.join(''),
method: "POST",
onSuccess : function(response) {
// sforce.debug.log(response);
console.log('response: ');
console.log(response);
var obj = JSON.stringify(xmlDoc);
console.log('stringify: ');
console.log(obj);
var jObj = JSON.parse(obj);
//alert("onSuccess: \n\n" + jObj);
console.log('JSON: ');
console.log(jObj);
return returnObject;
},
onFailure : function(response) {
console.log(response);
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(response,"text/xml");
//alert("onFailure end:" + xmlDoc);
return returnObject;
}
});
// Step 3: Get Response from GED WS - Khanh
return returnObject;
}
Thanks for your response
When you say "has access to this service", you mean the class "WebServiceTest" right ?
and enabled API
but the issue still occurs :
Whereas in Admin it works well :
Did I miss something else ?