Hi,
I am calling Soap Based Web Services from an application which is deployed in J Boss server. Part of my code snippet is given below.
Socket socket = new Socket();
SocketAddress sockaddr = new InetSocketAddress("xxxx", 8080);
socket.connect(sockaddr, 10000);
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(socket.getInetAddress(), 8080));
SOAPMessage soapMessage = createSOAPRequest(username, password, soapAction);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
soapMessage.writeTo(stream);
String message = new String(stream.toByteArray(), "UTF-8");
URL url = new URL(soapEndpointUrl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection)connection;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte[] buffer = new byte[message.length()];
buffer = message.getBytes();
bout.write(buffer);
byte[] b = bout.toByteArray();
httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
httpConn.setRequestProperty("SOAPAction", soapAction);
httpConn.setRequestMethod("GET");
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
OutputStream outputStream = httpConn.getOutputStream();
outputStream.write(b);
outputStream.close();
If I run this code as a standalone Java Program out of J Boss, it's working fine. But the same code is integrated in the main application and deployed in J Boss server is throwing with the below Exception. I am using jdk 1.8 and imported the respective certificate in jre/lib/security.
Caused by: javax.net.ssl.SSLException: java.security.ProviderException: Could not derive key
Caused by: java.security.ProviderException: Could not derive key
at sun.security.ec.ECDHKeyAgreement.engineGenerateSec ret(ECDHKeyAgreement.java:133)
at sun.security.ec.ECDHKeyAgreement.engineGenerateSec ret(ECDHKeyAgreement.java:163)
at javax.crypto.KeyAgreement.generateSecret(KeyAgreem ent.java:648)
at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCry pt.java:102)
at sun.security.ssl.ClientHandshaker.serverHelloDone( ClientHandshaker.java:1061)
at sun.security.ssl.ClientHandshaker.processMessage(C lientHandshaker.java:348)
at sun.security.ssl.Handshaker.processLoop(Handshaker .java:1026)
at sun.security.ssl.Handshaker.process_record(Handsha ker.java:961)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocke tImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHands hake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLS ocketImpl.java:1413)
... 85 common frames omitted
Caused by: java.security.InvalidAlgorithmParameterException: null
Please help me in find out the root cause and solution.
Thanks,
Srinivas