使用wsdl的vb.net中的DoCapture



我需要开发一种方法来在贝宝中实现doCapture方法。

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

然后我有两个问题:

1.错误3"y"已在此枚举中声明。所以我删除了引用文件中的"y"。

2.需要从参考文件中删除额外的(),如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'。"

这是我使用的url的配置:

<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>

我该如何解决这个问题?

提前感谢

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

相关内容

  • 没有找到相关文章

最新更新