Skip to Main Content

Integration

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

BPEL throwing 403 Forbidden error while invoking SOAP WebService Java client from OC4J 10.1.3.1 serv

NKKannanJan 28 2016 — edited Feb 26 2020

We have written a Secure (2 Way SSL Authentication) SOAP WebServices client in Java 1.5. We are calling this java client from a BPEL Service deployed on OC4J 10.1.3.1 server. While invoking the Java client through BPEL we are getting error at SOAPConnection call. When we execute the Java client from command prompt, its giving us proper response. While deployed on server and calling from there its failing. We have verified the certificates inside the cacerts of $ORACLE_HOME/jre/lib/security path. Its been imported properly using the keytool. The same way its been imported to the java 1.5 cacerts. Not able to figure out if we are missing any setting inside OC4J SSL Setting. Could anyone please guide us in finding the root cause of this problem, much appreciated.

Java client code:

            SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
            SOAPConnection soapConnection = soapConnectionFactory.createConnection();
            String url = "https://hostname/service.asmx";
            SOAPMessage soapRequest = createSoapRequest();
           
            SSLContext ctx;
            KeyManagerFactory kmf;
            KeyStore ks;
            ctx = SSLContext.getInstance("SSL");

            kmf = KeyManagerFactory.getInstance("IbmX509");
            ks = KeyStore.getInstance("PKCS12");
            ks.load(new FileInputStream("/home/xxx/tmp/xxx.pfx"), "password".toCharArray());
            kmf.init(ks, "password".toCharArray());
            ctx.init(kmf.getKeyManagers(), null, new java.security.SecureRandom());

            try {
                HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());

                WriterOutputStream wo = new WriterOutputStream();
                soapRequest.writeTo(wo);
                this.soapXMLLog = wo.toString();
                wo.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            SOAPMessage soapResponse = soapConnection.call(soapRequest, url);   // This is the place where the exception is happening.
            response = createSoapResponse(soapResponse);
            soapConnection.close();
  
Error stack:
            javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 403 Forbidden
                at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:155)
                at com.xxx.webservice.wrapper.xxx.xxx(xxx.java:193)
                at bpel.xxx.ExecLetBxExe2.execute(ExecLetBxExe2.java:407)
                at com.collaxa.cube.engine.ext.wmp.BPELXExecWMP.__executeStatements(BPELXExecWMP.java:49)
                at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:195)
                at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3715)
                at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1655)
                at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
                at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:220)
                at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:317)
                at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5710)
                at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1085)
                at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:583)
                at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:422)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:619)
                at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
                at java.security.AccessController.doPrivileged(AccessController.java:361)
                at javax.security.auth.Subject.doAs(Subject.java:573)
                at com.evermind.server.ThreadState.runAs(ThreadState.java:648)
                at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
                at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
                at CubeDeliveryBean_LocalProxy_4bin6i8.handleInvoke(Unknown Source)
                at com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessageHandler.handle(InvokeInstanceMessageHandler.java:37)
                at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:142)
                at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
                at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:619)
                at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
                at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
                at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
                at oracle.j2ee.connector.messageinflow.MessageEndpointImpl.OC4J_invokeMethod(MessageEndpointImpl.java:297)
                at WorkerBean_EndPointProxy_4bin6i8.onMessage(Unknown Source)
                at oracle.j2ee.ra.jms.generic.WorkConsumer.run(WorkConsumer.java:268)
                at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
                at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
                at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
                at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
                at java.lang.Thread.run(Thread.java:834)
Caused by: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 403 Forbidden
                at java.security.AccessController.doPrivileged(AccessController.java:330)
                at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:151)
                ... 57 more
Caused by: javax.xml.soap.SOAPException: Bad response: 403 Forbidden
                at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:462)
                at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:939)
                at java.security.AccessController.doPrivileged(AccessController.java:326)
                ... 58 more

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 23 2016
Added on Jan 28 2016
11 comments
2,765 views