We tried different security header options and none of them is worked worked.
Current SOA is not support NTML authentication in Oracle SOA, we need to write a customer java code to call external NTML autheticated service.
In order to achieve that, we use java embedded inside BPEL code to call external service. code looks .
try {
String userAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13";
org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient();
String soapAction ="NameSpaceof method"+"Method";
org.apache.commons.httpclient.methods.PostMethod postMethod = new org.apache.commons.httpclient.methods.PostMethod("URL".trim()); postMethod.setRequestHeader("SOAPAction", soapAction);
postMethod.setRequestHeader("Content-Type", "text/xml; charset=UTF-8");
postMethod.setRequestHeader("SOAPAction", soapAction);
postMethod.setRequestHeader("User-Agent", userAgent);
postMethod.setRequestEntity(new org.apache.commons.httpclient.methods.StringRequestEntity(soapMessage.toString().trim(), "text/xml; charset=UTF-8", null));
String errorMessage ="";
String responseBodyString ="";
org.apache.commons.httpclient.NTCredentials ntCredentials = new org.apache.commons.httpclient.NTCredentials("Ravikumar-Punna", "xxxxxxx", "hostName", "NA");
client.getState().setCredentials(new org.apache.commons.httpclient.auth.AuthScope(null,-1,null), ntCredentials);
int status = client.executeMethod(postMethod);
if(status != org.apache.commons.httpclient.HttpStatus.SC_OK)
{
errorMessage = "Method Failed :" + postMethod.getStatusLine();
// System.out.println(errorMessage);
}
responseBodyString= postMethod.getResponseBodyAsString();
System.out.println("Response Message ;" +responseBodyString);
setVariableData("FantaticServiceResult", responseBodyString);
}catch(Exception e) {
}
This will call a NTML enabled external service .. simple :)
This is giving Method Failed :HTTP/1.1 401 Unauthorized. Can you please check?
ReplyDelete