我正在尝试创建一个针对masspay 的虚拟请求并且遇到了麻烦。masspay正在崩溃并返回这个。
com.paypal.sdk.exceptions.TransactionException:底层连接已关闭:接收时发生意外错误。---> System.Reflection.TargetInvocationException:调用的目标已抛出异常。---> System.Net.WebException:底层连接已关闭:接收时发生意外错误。---> System.IO.IOException: Unable to read data from the transport connection: 一个现有的连接被远程主机强行关闭。---> System.Net.Sockets.SocketException: 远程主机在 System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) 处强制关闭现有连接 --- End of inner异常堆栈跟踪---在 System.Net.FixedSizeReader 的 System.Net.Sockets.NetworkStream.Read(Byte[] 缓冲区,Int32 偏移量,Int32 大小)。
这是我的代码的样子。有人可以告诉我我做错了什么: Dim MassPayReqItem As New MassPayRequestItemType MassPayReqItem.Amount = New BasicAmountType MassPayReqItem.Amount.currencyID = CurrencyCodeType.USD MassPayReqItem.Amount.Value = 15.0 MassPayReqItem.Note = "test mass payment" MassPayReqItem.ReceiverEmail =“用户@email.com”
Dim MassPayReqItem1 As New MassPayRequestItemType
MassPayReqItem1.Amount = New BasicAmountType
MassPayReqItem1.Amount.currencyID = CurrencyCodeType.USD
MassPayReqItem1.Amount.Value = 5.0
MassPayReqItem1.Note = "test mass payment1"
MassPayReqItem1.ReceiverEmail = "user1@email.com"
Dim massPayItemsArray(1) As MassPayRequestItemType
massPayItemsArray.SetValue(MassPayReqItem, 0)
massPayItemsArray.SetValue(MassPayReqItem1, 1)
Dim MassPayReqType As New MassPayRequestType
MassPayReqType.MassPayItem = massPayItemsArray
MassPayReqType.Version = "51.0"
MassPayReqType.EmailSubject = "Mass Payment from from me " _
& Date.Now.ToLongTimeString
Dim profile As IAPIProfile = ProfileFactory.createSignatureAPIProfile()
Dim caller As New com.paypal.sdk.services.CallerServices()
profile.APIUsername = "fsadsfdafsdasfad1.gmail.com"
profile.APIPassword = "fafsdafafaddsaf"
profile.APISignature = "Alq1UN0gL5pSkR-311R7KRCKujzNfdsaasgasgsagsagcOvcvz-hn5Rd"
caller.APIProfile = profile
Try
'send request, return response
Dim MPRes As New MassPayResponseType
MPRes = DirectCast(caller.[Call]("MassPay", MassPayReqType), MassPayResponseType)
Select Case MPRes.Ack
Case AckCodeType.Success
Response.Write("API response: <b>" & MPRes.Ack.ToString _
& "</b><br> Timestamp: <b>" & MPRes.Timestamp.ToLongTimeString _
& "</b><br> Version: <b>" & MPRes.Version.ToString)
Case Else
Response.Write("API response: <b>" & MPRes.Ack.ToString _
& "</b><br> Timestamp: <b>" & MPRes.Timestamp.ToLongTimeString _
& "</b><br> Version: <b>" & MPRes.Version.ToString _
& "</b><br> Error code: <b>" & MPRes.Errors(0).ErrorCode _
& "</b><br> Short error: <b>" & MPRes.Errors(0).ShortMessage _
& "</b><br> Long error: <b>" & MPRes.Errors(0).LongMessage)
End Select
Catch ex As Exception
Response.Write(ex.ToString)
End Try