Hello,
Well, I can't find the way out. I google a lot, try different kind of ways, code examples, etc etc. and I am having this weird problem.
In SoapUI I can test the web service, and I can even authenticate to test the service.
But...
I can't make it by code.
So here are some print screens and the code I'm trying.
If you guys can help me out.
I will appreciate it.
thanks.
CODE:---------------
var WEBSERVICE_URL = "http://webservice:port/bla/bla/bla";
$.ajax({
url: WEBSERVICE_URL,
type: "POST",
dataType: "json",
username: "user",
password: "password",
processData: false,
crossDomain: true,
contentType: "application/json",
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic SomeLettersAndNumbers_I_GotBySoapUI_IKnowHereItGoesTheKeyString==");
},
success: function () {
alert("success");
},
error: function (xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
alert(xhr.responseText);
},
});