[resolved] Bad response: 403Forbidden error using tSoap and client certificate

One Star

[resolved] Bad response: 403Forbidden error using tSoap and client certificate

I am trying to call a SOAP webservice method over HTTPS using a client authentication certificate. I have installed the certificate in java keystore (cacerts), and have used tSetKeyStore in my Talend job to initialize it. Then I use a tSoap component to make the request. I get the following error. Please suggest a solution.
connecting to socket on port 3400
connected
Dec 20, 2013 12:53:54 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0008: Bad Response; Forbidden
Exception in component tSOAP_1
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:109)
at test3.test3_0_1.Test3.tSOAP_1Process(Test3.java:304)
at test3.test3_0_1.Test3.tSetKeystore_1Process(Test3.java:414)
at test3.test3_0_1.Test3.runJobInTOS(Test3.java:610)
at test3.test3_0_1.Test3.main(Test3.java:476)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)
... 6 more
CAUSE:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)
disconnected
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:109)
at test3.test3_0_1.Test3.tSOAP_1Process(Test3.java:304)
at test3.test3_0_1.Test3.tSetKeystore_1Process(Test3.java:414)
at test3.test3_0_1.Test3.runJobInTOS(Test3.java:610)
at test3.test3_0_1.Test3.main(Test3.java:476)
CAUSE:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)
at org.talend.soap.SOAPUtil.invokeSOAP(SOAPUtil.java:109)
at test3.test3_0_1.Test3.tSOAP_1Process(Test3.java:304)
at test3.test3_0_1.Test3.tSetKeystore_1Process(Test3.java:414)
at test3.test3_0_1.Test3.runJobInTOS(Test3.java:610)
at test3.test3_0_1.Test3.main(Test3.java:476)
Job Test3 ended at 12:53 20/12/2013.

Accepted Solutions
One Star

Re: [resolved] Bad response: 403Forbidden error using tSoap and client certificate

I have figured out the problem. In this case, perhaps the certificate was not being detected properly. I had a pkcs12 certificate provided by the webservice team to be used for client authentication. I had imported it to Java keystore (...\lib\security\cacerts) and had used tSetKeystore component. The trick to solution was to check the "Need client authentication" and provide the pkcs12 certificate path and password.

All Replies
One Star

Re: [resolved] Bad response: 403Forbidden error using tSoap and client certificate

I have figured out the problem. In this case, perhaps the certificate was not being detected properly. I had a pkcs12 certificate provided by the webservice team to be used for client authentication. I had imported it to Java keystore (...\lib\security\cacerts) and had used tSetKeystore component. The trick to solution was to check the "Need client authentication" and provide the pkcs12 certificate path and password.
One Star

Re: [resolved] Bad response: 403Forbidden error using tSoap and client certificate

Hi There,

We are also facing the similar problem while invoking the client WebService.

Dec 1, 2015 3:39:28 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0008: Bad Response; Forbidden
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:160)
        .................................................................................................................................
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:270)
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:156)
        ... 2 more
CAUSE:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:270)
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:156)
        .................................................................................................................................
CAUSE:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (403Forbidden
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:270)
        at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:156)

Could you please let me know what exact approach you had taken to fix your problem?

Thank you.