Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java paypal调用从不返回结果_Java_Paypal_Website Payment Pro - Fatal编程技术网

Java paypal调用从不返回结果

Java paypal调用从不返回结果,java,paypal,website-payment-pro,Java,Paypal,Website Payment Pro,Java我正在使用paypal网站pro sdk SOAP调用问题是以下代码行在长时间后返回异常 response = (CreateRecurringPaymentsProfileResponseType) caller.call("CreateRecurringPaymentsProfile", request); Exception is as follows. java.net.SocketException: Connection reset java.lang.reflect.I

Java我正在使用paypal网站pro sdk SOAP调用问题是以下代码行在长时间后返回异常

response = (CreateRecurringPaymentsProfileResponseType) caller.call("CreateRecurringPaymentsProfile", request);

Exception is as follows.

java.net.SocketException: Connection reset
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.paypal.sdk.core.soap.SOAPAPICaller.callSOAP(SOAPAPICaller.java:462)
    at com.paypal.sdk.core.soap.SOAPAPICaller.call(SOAPAPICaller.java:382)
    at com.paypal.sdk.services.CallerServices.call(CallerServices.java:125)
    at CreateRecurringPaymentsProfile.callCreateRecurringPaymentsProfileAPI(CreateRecurringPaymentsProfile.java:85)
    at CreateRecurringPaymentsProfile.run(CreateRecurringPaymentsProfile.java:50)
    at CreateRecurringPaymentsProfile.main(CreateRecurringPaymentsProfile.java:22)
Caused by: java.net.SocketException: Connection reset
我需要任何证书或其他东西吗?目前我正在使用classes文件夹中的proxy,如下所示

# This file contains the properties that needs to be set to make the API call via Proxy.


# To make use of proxy, change PROXY_SET to true, uncomment 
# PROXY_HOST and PROXY_PORT properties and set values as illustrated below.
# Note: Just remove the # symbol to uncomment. 
# Both  PROXY_HOST and PROXY_PORT needs to be set. PROXY_PORT should be a number.
# If any one of these properties are not set or invalid, proxy settings will be ignored
# and this information will be logged.

# PROXY_HOST : IP Address or Host Name of the proxy server
# PROXY_PORT: Port number of the proxy server

 PROXY_SET = true 

 PROXY_HOST=128.1.100.13
# eg: PROXY_HOST = 127.0.0.1

 PROXY_PORT=8080
# eg: PROXY_PORT = 808

# The following properties are optional.
# If your proxy need username and password to authenticate, 
# just uncomment the following two properties and set values as illustrated below.
# Note: Just remove the # symbol to uncomment. 

# PROXY_USERNAME=<your proxy username>
# eg: PROXY_USERNAME =test

# PROXY_PASSWORD=<your proxy password>
# eg: PROXY_PASSWORD =test
public class CreateRecurringPaymentsProfile {
    CallerServices caller;

    public static void main(String[] args) {
        try {
            CreateRecurringPaymentsProfile sample = new CreateRecurringPaymentsProfile();
            sample.run();
        }
        catch (Exception e) {
            System.out.println("ERROR: " + e.getMessage());
        }
    }

    public CreateRecurringPaymentsProfile() throws PayPalException {
        caller = new CallerServices();

        /*
         WARNING: Do not embed plaintext credentials in your application code.
         Doing so is insecure and against best practices.
         Your API credentials must be handled securely. Please consider
         encrypting them for use in any production environment, and ensure
         that only authorized individuals may view or modify them.
         */

        APIProfile profile = ProfileFactory.createSignatureAPIProfile();
        profile.setAPIUsername("f_1299578055_biz_api1.gmail.com");
        profile.setAPIPassword("152578076");
        profile.setSignature("A.SG-Qkp9mcSwx0zh23u89eyCcWGA9MwmCgRlo2193..VNw06q1WbLTx");
        profile.setEnvironment("sandbox");
        caller.setAPIProfile(profile);
    }

    public void run() throws PayPalException {

        callCreateRecurringPaymentsProfileAPI();
        System.out.println("\nDone...");
    }



    public void callCreateRecurringPaymentsProfileAPI() throws PayPalException {
        System.out.println("\n########## Starting CreateRecurringPaymentsProfile ##########\n");

        //Replace the token value by actual value returned vy SetCustomerBillingAgreementAPI call
        String token="RP-8P463231B6009345R";
        String amount ="5.00";
        int BF=1;
        BillingPeriodType BP = BillingPeriodType.Day;

        CreateRecurringPaymentsProfileRequestType request=new CreateRecurringPaymentsProfileRequestType();
        CreateRecurringPaymentsProfileResponseType response=new CreateRecurringPaymentsProfileResponseType();
        request.setVersion("51.0");
        request.setCreateRecurringPaymentsProfileRequestDetails(new CreateRecurringPaymentsProfileRequestDetailsType())  ;
        request.getCreateRecurringPaymentsProfileRequestDetails().setToken(token);
        request.getCreateRecurringPaymentsProfileRequestDetails().setRecurringPaymentsProfileDetails(new RecurringPaymentsProfileDetailsType());

        Calendar start_date = Calendar.getInstance();
        start_date.set(2008,5,30);

        request.getCreateRecurringPaymentsProfileRequestDetails().getRecurringPaymentsProfileDetails().setBillingStartDate(start_date);
        request.getCreateRecurringPaymentsProfileRequestDetails().setScheduleDetails(new ScheduleDetailsType());
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().setPaymentPeriod(new BillingPeriodDetailsType());
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().setDescription("RP-Test- Java SOAP SDK");
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().getPaymentPeriod().setAmount(new BasicAmountType());
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().getPaymentPeriod().getAmount().set_value(amount) ;
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().getPaymentPeriod().getAmount().setCurrencyID(CurrencyCodeType.USD);
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().getPaymentPeriod().setBillingFrequency(BF);
        request.getCreateRecurringPaymentsProfileRequestDetails().getScheduleDetails().getPaymentPeriod().setBillingPeriod(BP);

        response = (CreateRecurringPaymentsProfileResponseType) caller.call("CreateRecurringPaymentsProfile", request);

        if (!response.getAck().equals(AckCodeType.Success) && !response.getAck().equals(AckCodeType.SuccessWithWarning)) {
            // do error processing
            System.out.println("\n########## CreateRecurringPaymentsProfile call failed ##########\n");
        } else {
            //success
            System.out.println("\n########## CreateRecurringPaymentsProfile call passed ##########\n");
        }


    }


}
在developer.paypal.com网站上,我创建了以下帐户

编辑出于安全原因删除。

能否检查java.policy文件以检查是否存在任何限制或其他问题,可能需要在此处添加SocketPermission以允许应用程序连接

这是一个HTTP代理问题。当我从网络中删除HTTP代理时,它已被修复

祝贺你,你刚刚告诉了数百万人你的PayPal帐户的密码。马上换。还有你的银行账户详细信息。预计未来几个月易趣用户会有很多抱怨,因为有人会用你的名字开立账户,并进行大规模欺诈。哈哈,你认为我很愚蠢,我提供了原始通行证……;)这些都是测试帐户,顺便说一句,dun担心如果你想删除它再次发布(没有敏感位),请标记它以引起版主注意。我已经授予了连接权限,但仍然没有luckabove代码与直接连接到internet的计算机完美配合。我是代理的幕后黑手,因此出现此错误。我已经设置了代理配置,但仍然没有luckproxy可能会阻止某些协议的响应,请尝试其他返回soap的web服务,如果该服务正常,则此应用的代理配置不正常。