3

I am trying to create a dummy request to masspay and am running into trouble. The masspay is crashing and returning this.

com.paypal.sdk.exceptions.TransactionException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at com.paypal.soap.api.PayPalAPISoapBinding.MassPay(MassPayReq MassPayReq) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at com.paypal.sdk.core.soap.SOAPAPICaller.CallSOAP(MethodInfo method, Object obj, Object[] args) --- End of inner exception stack trace --- at com.paypal.sdk.core.soap.SOAPAPICaller.CallSOAP(MethodInfo method, Object obj, Object[] args) at com.paypal.sdk.core.soap.SOAPAPICaller.Call(String operationName, AbstractRequestType request) at StorkBrokers.masspaytest.Page_Load(Object sender, EventArgs e) in masspaytest.aspx.vb:line 86

Here is what my code looks like. Could someone please tell me what I am doing wrong: 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 = "user@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
jttj109
  • 31
  • 2

0 Answers0