Senthil kumar
Senthil kumar

Reputation: 21

403 Forbidden during setExpressCheckout

I am getting the following error during Expresscheckout in sandbox account using setExpressCheckout method. I am using SOAP library paypal_base.jar, paypal_stubs.jar

PM com.paypal.sdk.exceptions.TransactionException <init>
SEVERE: (403)Forbidden

Anyone help me to resolve this issue?

Upvotes: 2

Views: 1302

Answers (3)

user3222211
user3222211

Reputation: 21

This is like a summery of all answers above along with additional reference.

As mentioned by user3405529 follow the link and understand your problem.

Merchants using the HTTP 1.0 protocol.

This is common for all who are using old PayPal API with axis 1.4

This is the problem in my project.

I referred this link for more details to understand and solve the problem

http://marc.info/?l=axis-user&m=119144869612056

There are four ways to solve this

1)Modify axis source code to use HTTP 1.1 protocol

    String httpver = msgContext.getStrProp(MessageContext.HTTP_TRANSPORT_VERSION);
    if (null == httpver) {
         httpver = HTTPConstants.HEADER_PROTOCOL_V11;
    }
    //httpver = httpver.trim();
    //if (httpver.equals(HTTPConstants.HEADER_PROTOCOL_V11)) {
    //   http10 = false;
    //}

OR Set Message Context msgContext.setStrProp(..) as HTTPConstants.HEADER_PROTOCOL_V11

Then rebuild axis and maintain your own source code for reference

2)As per user3405529 use client-config.wsdd in classpath with java:org.apache.axis.transport.http.CommonsHTTPSender in transport tag

I tested with this changes and it is working as expected.

But both the approaches use HTTP 1.1 by default. In our project as we are not prepared for this change of HTTP protocol version.

see more details at http://www2.research.att.com/~bala/papers/h0vh1.html

3)Update the PayPal stub and rebuild it for use - I do not try it.

4)Update the PayPal SDK to latest version...

We go with updated PayPal SDK. It will be helpful in future.

I hope it is helpful

Upvotes: 1

user3405529
user3405529

Reputation: 21

add a client-config.wsdd to your classpath to use http1.1. You can set log4j to debug level to see if you are useing http 1.0 now. If not, this will not help you. Content of file:

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig"
            xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
    </transport>
    <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/>
    <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/>
</deployment>

Upvotes: 1

user3405529
user3405529

Reputation: 21

please refer to to https://www.paypal-notify.com/eventnotification/event_details?eventId=4283. You can try to use "org.apache.axis.transport.http.CommonsHTTPSender" in axis to support http1.1. You have to use axis 1.3 or more as 1.2 has bug with https connection

Upvotes: 1

Related Questions