System.Nullreferenceexception

Asked

Viewed 57 times

0

There is a webservice that I need to create which needs to have some particularities, among them, the information of Soapaction (as below). However, when I put and will debug I already get the error when testing the contents of the variable "orderID", returns:

System.Nullreferenceexception: 'Undefined object reference for an instance of an object. ' ==> confirmPaymentRequest was Nothing)

When I shoot the Soapaction works, but the customer fails to consume because it returns the following error:

System.Web.Services.Protocols.Soapexception: The server did not recognize the value of the HTTP header Soapaction: confirmPayment.

I don’t know what else to do, given the very little experience in Ws.

Below follows the method:

<WebMethod()>
    <SoapDocumentMethod(Action:="confirmPayment")>
    Public Function confirmPayment(ByVal confirmPaymentRequest As ps.confirmPaymentRequest) As ps.confirmPaymentResponse

        Dim retorno As New ps.confirmPaymentResponse()
        Dim orderID As String = confirmPaymentRequest.orderId
        Dim status As String = confirmPaymentRequest.status
        sql = "insert into ws_payment (orderid, status) values ('" & orderID & "','" & status & "')"
        txtExec = bco.exec(clsRetAcesso.acesso(homologacao, "dbWS"), sql)
        If txtExec <> "OK" Then
            retorno.success = False
            My.Computer.FileSystem.WriteAllText(LocalLog, Date.Now & " - 0030 - Erro: " & txtExec & vbNewLine & "SQL: " & sql & vbNewLine, True)
        Else
            retorno.success = True
        End If
        Return retorno
    End Function

'------------------------------------------------
' 
  • 1

    The problem is not there, it is in the call of this method.

  • There are other webservices in this project that make the call as in this example and that gave no problem. Unfortunately, because I don’t know much I’m doing it by trial and error, but I’m not getting it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.