Reputation: 1
I am facing trouble connecting to a Restful Webservice in Boomi from my jquery code. Its basically a cross domain request from javascript to webservice. Below is my jquery code.
<script type="text/javascript">
function LoadSurvey() {
makeCorsRequest();
}
function makeCorsRequest() {
jQuery.support.cors = true;
var URL = 'https://boomi-example.com/ws/rest/Candidate/1';
$.ajax({
//beforeSend: function (xhr) {
// xhr.setRequestHeader("Authorization", "Basic ZXJuc3R5b3VuZy1NRE5IWEouR1QwS1IwOjAyZGQ1NmNmLTQ0ZDEtNDBlNC05YmNjLTg2M2ViNGUyMzA4NA==");
//},
type: "GET",
//jsonpCallback: 'JSON_CALLBACK',
//jsonp: false,
url: URL,
//dataType: 'jsonp',
username: '****,
password: '****',
//crossDomain: true,
//xhrFields: {
// withCredentials: true
//},
headers: {
'Authorization': 'Basic ZXJuc3R5b3VuZy1NRE5IWEouR1QwS1IwOjAyZGQ1NmNmLTQ0ZDEtNDBlNC05YmNjLTg2M2ViNGUyMzA4NA=='
},
contentType: 'application/json; charset=utf-8',
success: function (data, textStatus, jqXHR) {
alert(JSON.stringify(data));
},
error: function (jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
alert(textStatus);
alert(errorThrown);
},
complete: function (jqXHR, textStatus) {
alert(JSON.stringify(jqXHR));
}
});
}
</script>
I have already searched and applied everything from javascript side. As per boomi documentation, we need to configure CORS header in Boomi API which we have already set. But those headers are not return when I checked the response headers.
Below is the error XMLHttpRequest cannot load ...... Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource ..... Origin is therefore not allowed access. The response had HTTP status code 403.
Basically we have to set Access-Control-Allow-Origin from server side which works well with .Net WEB API. But for boomi,its failing to return the origin header. As per Boomi documentation http://help.boomi.com/atomsphere/GUID-0E38FB83-331E-45B1-8E12-0014048D6663.html , below headers need to be returned in response for CORS request to work.
Access-Control-Allow-Origin: https://example.com
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: X-Custom-Header, Some-Other-Header
Only response headers that are returned are below ones
HTTP/1.1 403 Forbidden Content-Length: 0 Server: Jetty(6.1.26-boomi2) Set-Cookie: BIGipServerP_BOOMI10-STAGE.SUCCESSFACTORS.COM-9090=1863780874.33315.0000; path=/
If Jsonp is solution ,pls tell how to write callback function in Boomi. I cannot create any proxy server for this requirement.
Please help, Thanks in Advance
Upvotes: 0
Views: 1015
Reputation: 1
I managed to get CORS working today with Dell Boomi. We had to add the boomi_auth= to the url to get the http preflight messages working. Preflight messages can be recognized as OPTIONS in the log file of your Boomi shared server.
I'll document the stuff and how to test CORS with Boomi on my website as soon as I have everything complete. Right now, it only seems to work with Origin *. Can't draw conclusions yet, more news soon.
Example URL:
Upvotes: 0