Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

"Cipher not initialized" when trying to invoke CRM On Demand web service

Sreeni TJan 20 2010 — edited Feb 27 2020
Hi,
I'm try to invoke CRM On Demand web service for which there is a pre-req to get a session ID by making an https request. I've the below java embedded code which does that. It works fine if I run the below code in my desktop as a java program, but when I deploy it on SOA 11g I get "Caused by: java.lang.IllegalStateException: Cipher not initialized" error (find below the stack trace). Please let me know what's going wrong here?
------
String sessionString = "FAIL";
String wsLocation =
"https://secure-********.crmondemand.com/Services/Integration";
String headerName;
try {
// create an HTTPS connection to the OnDemand webservices
java.net.URL wsURL =
new java.net.URL(wsLocation + "?command=login");
java.net.HttpURLConnection wsConnection =
(java.net.HttpURLConnection)wsURL.openConnection();
// disable caching
wsConnection.setUseCaches(false);
// set some http headers to indicate the username and password we are using to logon
wsConnection.setRequestProperty("UserName",
"***************/**********");
wsConnection.setRequestProperty("Password", "***********");
wsConnection.setRequestMethod("GET");
// see if we got a successful response
if (wsConnection.getResponseCode() ==
java.net.HttpURLConnection.HTTP_OK) {
// get the session id from the cookie setting
for (int i = 0; ; i++) {
headerName = wsConnection.getHeaderFieldKey(i);
if (headerName != null &&
headerName.equals("Set-Cookie")) {
// found the Set-Cookie header (code assumes only one cookie is being set)
sessionString = wsConnection.getHeaderField(i);
if (sessionString != null ||
sessionString.startsWith("JSESSIONID")) {
break;
}
}
}
String formattedID =
sessionString.substring(sessionString.indexOf("=") + 1,
sessionString.indexOf(";"));
setVariableData("SessionID", formattedID);
//System.out.println("Session ID: " + sessionString);
}
} catch (Exception e) {
e.printStackTrace();
setVariableData("SessionID", e.getMessage());
System.out.println("Logon Exception generated :: " + e);
throw new RuntimeException(e);
}

-------
Caused by: java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.c(DashoA13*..)
at javax.crypto.Cipher.update(DashoA13*..)
at com.certicom.tls.provider.Cipher.update(Unknown Source)
at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
at com.certicom.tls.record.MessageEncryptor.compressEncryptSend(Unknown Source)
at com.certicom.tls.record.MessageFragmentor.write(Unknown Source)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source)
at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source)
at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source)
at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at weblogic.net.http.HttpURLConnection.writeRequests(HttpURLConnection.java:158)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:363)
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:952)
at orabpel.productquerybpelprocess.ExecLetBxExe0.execute(ExecLetBxExe0.java:93)
--------
Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 11 2010
Added on Jan 20 2010
2 comments
2,343 views