使用wsdl在vb.net中使用DoCapture

时间:2015-02-19 13:33:05

标签: vb.net paypal vb.net-2010 paypal-sandbox

我需要开发一种在paypal中实现doCapture方法的方法。

我在Visual Studio 2010中使用vb.net。 我创建了一个测试winform项目,使用url =“https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl

添加服务引用

然后我遇到了2个问题:

1.错误3'y'已在此枚举中声明。 所以我删除了参考文件中的“y”。

2.需要从参考文件中删除extra(),如Private merchantDataField()() As TupleType

然后我添加了这段代码`

    Dim i As ws.PayPalAPIAAInterfaceClient = New ws.PayPalAPIAAInterfaceClient()

    Dim _DoCaptureReq As ws.DoCaptureReq = New ws.DoCaptureReq


    Dim _DoCaptureResponseType As ws.DoCaptureResponseType = New ws.DoCaptureResponseType
    Dim _CustomSecurityHeaderType As ws.CustomSecurityHeaderType = New ws.CustomSecurityHeaderType
    _DoCaptureReq.DoCaptureRequest = New DoCaptureRequestType()
    _DoCaptureReq.DoCaptureRequest.Amount = New BasicAmountType()
    _DoCaptureReq.DoCaptureRequest.Amount.Value = "10"
    _DoCaptureReq.DoCaptureRequest.Amount.currencyID = CurrencyCodeType.ILS
    _DoCaptureReq.DoCaptureRequest.AuthorizationID = 122334



    Dim APIAccountName As String = "aa"
    Dim APIAccountPassword As String = "bb"
    Dim Signature As String = "cc"

    _CustomSecurityHeaderType.Credentials = New UserIdPasswordType()
    _CustomSecurityHeaderType.Credentials.Username = APIAccountName
    _CustomSecurityHeaderType.Credentials.Password = APIAccountPassword
    _CustomSecurityHeaderType.Credentials.Signature = Signature
    _CustomSecurityHeaderType.Credentials.Subject = ""



    _DoCaptureResponseType = i.DoCapture(_CustomSecurityHeaderType, _DoCaptureReq)`

当我拨打i.DoCapture(最后一行)时,我收到错误

  

“无法为具有权限的SSL / TLS建立安全通道   'api-aa.sandbox.paypal.com'“。

这是我使用的网址配置:

<client>
            <endpoint address="https://api.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
                bindingConfiguration="PayPalAPISoapBinding" contract="ws.PayPalAPIInterface"
                name="PayPalAPI" />
            <endpoint address="https://api-aa.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
                bindingConfiguration="PayPalAPIAASoapBinding" contract="ws.PayPalAPIAAInterface"
                name="PayPalAPIAA" />
        </client>

我该如何解决这个问题?

提前致谢

1 个答案:

答案 0 :(得分:0)

使用签名时,请将端点地址设置为https://api-3t.sandbox.paypal.com/2.0/