Forum Stats

  • 3,838,259 Users
  • 2,262,346 Discussions
  • 7,900,563 Comments

Discussions

Accessing SSL Server from Java Embedding in BPEL

913963
913963 Member Posts: 12
Hello All,

We have a requirement of integrating CRM On Demand and JDEE with SOA Suite as an middle ware.

For initial development phase we have attempt to log in to CRM OD and able to create a Session ID and log out using JAVA code available @ http://www.webbasedcrmsoftware.com.au/crm-on-demand-tutorials/65-java-access-to-crm-on-demand

When we run the same log in java code from the SOA BPEL following the best practice @ http://www.oracle.com/technetwork/topics/ofm-siebel-blog-postings-092216.html

I am getting an exception

Java_Embedding_for_CRM_Login
Jul 12, 2012 4:14:35 PM Logon
Jul 12, 2012 4:14:56 PM Logon Exception generated :: java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: secure-XXXXXXXX.crmondemand.com port: 443
Jul 12, 2012 4:14:56 PM Exceptionjava.util.NoSuchElementException
Jul 12, 2012 4:14:56 PM bpelx:exec executed

Code used for Login

String jsessionid, jsessionid_full, endpoint;

try {

addAuditTrailEntry("Logon");

String sessionString = "FAIL";
try {

// create an HTTPS connection to the On Demand webservices
URL wsURL = new URL("https://XXXXXXX.crmondemand.com/Services/Integration" +
"?command=login");
HttpURLConnection wsConnection = (HttpURLConnection)wsURL.openConnection();

// we don't want any caching to occur
wsConnection.setUseCaches(false);

// we want to send data to the server
// wsConnection.setDoOutput(true);
// set some http headers to indicate the username and passwod we are using to logon
wsConnection.setRequestProperty("UserName", "XXXX");
wsConnection.setRequestProperty("Password", "XXXX");
wsConnection.setRequestMethod("GET");

// see if we got a successful response
if (wsConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
// get the session id from the cookie setting

String headerName;
String headerValue = "FAIL";

for (int i = 0; ; i++) {

headerName = wsConnection.getHeaderFieldKey(i);
addAuditTrailEntry("headerName" + headerName);
if (headerName != null && headerName.equals("Set-Cookie")) {
// found the Set-Cookie header (code assumes only one cookie is being set)
headerValue = wsConnection.getHeaderField(i);
break;
}
}
sessionString = headerValue;
addAuditTrailEntry("headerValue" + headerValue);
}

}

catch (Exception e) {
System.out.println("Logon Exception generated :: " + e);
addAuditTrailEntry("Logon Exception generated :: " + e);
}


jsessionid_full = sessionString;

StringTokenizer st = new StringTokenizer(sessionString, ";");
jsessionid = st.nextToken();
st = new StringTokenizer(jsessionid, "=");
st.nextToken();

jsessionid = st.nextToken();
System.out.println(jsessionid);
setVariableData("SessionID",jsessionid);


}

catch (Exception e) {
System.out.println(e);
addAuditTrailEntry("Exception" + e);
}



we have downloaded the certificate from crmondemand.com and added to the weblogic SOA Trusted Key store

But still it is not working :(

We need a serious help from some experts

Edited by: 910960 on Jul 12, 2012 4:20 AM

Edited by: 910960 on Jul 19, 2012 2:40 AM
Tagged:

Answers

This discussion has been closed.