I am trying to call a Restful service on OSB. My code is:
string url = _httpGetText + "&$filter=" + filter;
WebRequest request = WebRequest.Create(url);
request.Method = "GET";
ServicePointManager.SecurityProtocol =
SecurityProtocolType.Tls |
SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls12;
request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes("CLLORptngAppIdDev:DPJZuogiYEo5"));
WebResponse response;
try
{
response = request.GetResponse();
List<HistoryRequest> histroyRequestList = LoadHistoryRequest(response);
return histroyRequestList;
}
catch(Exception ex)
{
string msg = ex.Message;
}
The message in the catch is: The remote server returned an error: (500) Internal Server Error.
On the serer side I see this message
<responseSelectedForConsumingProxyService>
<soap-env:Body
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>Server</faultcode>
<faultstring>This is an Oracle Service Bus generated fault.
[OSB-386420 - A web service security error ocurred while producing security header]
[RouteNode_XXXXXXXXXXXXV_1_0request-pipeline]
[instanceid - *********************************************;]
</faultstring>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Body>
</responseSelectedForConsumingProxyService>
As a result of comments I have also tried the following options with the exact same results:
request.Headers["Authorization"] = "Basic " + System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("UTF-8").GetBytes("<ID>:<Pssword>"));
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("<ID>:<Pssword>"));
request.Headers.Add("Authorization", "Basic " + encoded);
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("UTF-8").GetBytes("<ID>:<Pssword>"));
request.Headers.Add("Authorization", "Basic " + encoded);