403 Forbidden during setExpressCheckout

微笑、不失礼 提交于 2019-12-10 11:34:21

问题


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?


回答1:


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




回答2:


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>



回答3:


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



来源:https://stackoverflow.com/questions/22295967/403-forbidden-during-setexpresscheckout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!