Paypal 第一次尝试使用masspay时收到错误。
我试图创建一个对masspay的虚拟请求,但遇到了麻烦。masspay正在崩溃并退回这个 com.paypal.sdk.exceptions.TransactionException:基础连接已关闭:接收时发生意外错误。-->System.Reflection.TargetInvocationException:调用的目标已引发异常。-->System.Net.WebException:基础连接已关闭:接收时发生意外错误。-->System.IO.IOException:无法从传输连接读取数据:远程主机强制关闭了现有连接。-->System.Net.Sockets.SocketException:远程主机在System.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)----内部异常堆栈跟踪的结束---System.Net.Sockets.NetworkStream.Read(Byte[]buffer,Int32 offset,Int32 size)在System.Net.FixedSizeReader.ReadPacket处强制关闭了现有连接(字节[]缓冲区,Int32偏移量,Int32计数)在System.Net.Security。_sstream.StartFrameHeader(字节[]缓冲区,Int32偏移量,Int32计数,AsyncProtocolRequest asyncRequest)在System.Net.Security。_sstream.StartReading(字节[]缓冲区,Int32偏移量,Int32计数,AsyncProtocolRequest asyncRequest)在System.Net.Security。_sstream.ProcessRead(字节[])System.Net.TlsStream.Read(Byte[]buffer,Int32 offset,Int32 size)System.Net.PooledStream.Read(Byte[]buffer,Int32 offset,Int32 size)System.Net.Connection.SyncRead(HttpWebRequest请求,布尔userRetrievedStream,布尔ProberRead)System.Net.Connection---内部异常堆栈跟踪的结尾---在System.Web.Services.Protocol.WebClientProtocol.GetWebResponse(WebRequest请求)在System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest请求)在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,Object[]参数)在com.paypal.soap.api.PayPalAPISoapBinding.MassPay(MassPayReq MassPayReq)----内部异常堆栈跟踪的结尾---在System.RuntimeMethodHandle。在System.Reflection.RuntimeMethodInfo.Invoke处调用MethodFast(对象目标,对象[]参数,SignatureStruct&sig,MethodAttributes MethodAttributes,RuntimeTypeHandle typeOwner)com.paypal.sdk.core.soap.soapapapicaller.CallSOAP上的System.Reflection.RuntimeMethodInfo.Invoke(对象对象obj,BindingFlags invokeAttr,绑定器绑定器,对象[]参数,对象[]参数,CultureInfo区域性,布尔skipVisibilityChecks)(MethodInfo方法,对象obj,对象[]args)---内部异常堆栈跟踪的结尾---在com.paypal.sdk.core.soap.soapapapicaller.CallSOAP(MethodInfo方法,对象obj,对象[]args)在com.paypal.sdk.core.soap.SOAPAPICaller.Call(字符串操作名,AbstractRequestType请求)在StorkBrokers.masspaytest.Page(加载(对象发送者,事件args e)在masspaytest.aspx.vb中:第86行 下面是我的代码。有人能告诉我我做错了什么吗: 将MassPayRequestItem设置为新的MassPayRequestItemType MassPayReqItem.Amount=新的基本计数类型 MassPayReqItem.Amount.currencyID=CurrencyCodeType.USD MassPayReqItem.Amount.Value=15.0 MassPayReqItem.Note=“测试批量付款” MassPayReqItem.ReceiverEmail=”user@email.com"Paypal 第一次尝试使用masspay时收到错误。,paypal,masspay,Paypal,Masspay,我试图创建一个对masspay的虚拟请求,但遇到了麻烦。masspay正在崩溃并退回这个 com.paypal.sdk.exceptions.TransactionException:基础连接已关闭:接收时发生意外错误。-->System.Reflection.TargetInvocationException:调用的目标已引发异常。-->System.Net.WebException:基础连接已关闭:接收时发生意外错误。-->System.IO.IOException:无法从传输连接读取数据:
Dim MassPayRequestItem1作为新的MassPayRequestItemType
MassPayReqItem1.金额=新的基本金额类型
MassPayReqItem1.Amount.currencyID=CurrencyCodeType.USD
MassPayReqItem1.Amount.Value=5.0
MassPayReqItem1.Note=“测试批量付款1”
MassPayReqItem1.ReceiverEmail=”user1@email.com"
将massPayItemsArray(1)设置为MassPayRequestItemType
massPayItemsArray.SetValue(MassPayReqItem,0)
massPayItemsArray.SetValue(MassPayReqItem1,1)
将MassPayReqType设置为新的MassPayRequestType
MassPayReqType.MassPayItem=massPayItemsArray
MassPayReqType.Version=“51.0”
MassPayReqType.EmailSubject=“从我处批量付款”_
&Date.Now.ToLongTimeString
作为IAPIProfile=ProfileFactory.CreateSignatureApprofile()的Dim配置文件
将调用者设置为新的com.paypal.sdk.services.CallerServices()
profile.APIUsername=“fsadsfdafsfad1.gmail.com”
profile.APIPassword=“fafsdafaddsaf”
profile.APISignature=“Alq1UN0gL5pSkR-311R7KRCKujzNfdsaasgasgsagsagcOvcvz-hn5Rd”
caller.APIProfile=profile
尝试
'发送请求,返回响应
Dim MPRes作为新的MassPayResponseType
MPRes=DirectCast(调用者。[呼叫](“MassPay”,MassPayReqType),MassPayResponseType)
选择Case MPRes.Ack
案例AckCodeType。成功
Response.Write(“API响应:”&MPRes.Ack.ToString_
&
时间戳:“&MPRes.Timestamp.tolongtimestString”_
&
版本:“&MPRes.Version.ToString)
其他情况
Response.Write(“API响应:”&MPRes.Ack.ToString_
&
时间戳:“&MPRes.Timestamp.tolongtimestString”_
&
版本:“&MPRes.Version.ToString”_
&
错误代码:“&MPRes.Errors(0).ErrorCode_
&
短消息错误:“&MPRes.Errors(0)。短消息”_
&
长错误:“&MPRes.Errors(0.LongMessage)
结束选择
特例
Response.Write(例如ToString)
结束尝试
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