WEBSERVICE ASP.NET Method not found

Asked

Viewed 360 times

0

I have a problem in a webservice that I created and I tried several adjustment options and could not solve.

I have the list of Methods available according to the image below

Listagem dos Métodos disponíveis

When I select the VAPS method the form to fill the fields appears correctly and fill and send works correctly.

Chamada do Método

The url that must be built to be invoked by GET must have the following format according to the documentation.

Modelo de chamada do Método

But when running this url I get the following message

inserir a descrição da imagem aqui

All other methods are functional, the method problem not found occurs only with this one which is a new implementation, I believe there is something in the project that has not been updated.

Someone has already been through this and would have a solution?

I’ve restarted Machine, ISS, Visual Studio, changed input parameters, return type and none of it worked.

<WebMethod()>
    Public Function VAPS(CodTransacao As String, Email As String, Cod_Prod As Integer) As Boolean
        Dim cn As New MySqlConnection
        Dim sql As String

        Try
            sql = "SELECT * FROM TBL_CONCLUDED WHERE COD_PROD=@CodProd AND COD_TRANS=@CodTrans AND email=@email"

            Dim cmd = New MySqlCommand(sql, cn)

            cmd.Parameters.AddWithValue("@CodProd", Cod_Prod)
            cmd.Parameters.AddWithValue("@CodTrans", CodTransacao)
            cmd.Parameters.AddWithValue("@email", Email)

            cn.ConnectionString = ConfigurationManager.AppSettings("StrConn")

            Dim DA As New MySqlDataAdapter(cmd)
            Dim dt As New Data.DataTable

            cn.Open()

            DA.Fill(dt)

            MsgBox(dt.Rows.Count)

            If dt.Rows.Count > 0 Then
                Return True
            Else
                Return False
            End If

        Catch ex As Exception
            'MsgBox(ex.ToString)
            Return False
        End Try

        cn.Close()

    End Function

1 answer

1

Good afternoon.

It’s hard to opine without seeing the code, but the first thing I would do is force a [Httpget] into your web method. Example:

[HTTPGet]
public string VAPS()
{
   ...
}

Have you tried that?

  • Not directly, I’ll try here. But I am putting in Webconfig the following: <protocols> <add name="Httpsoap"/> <add name="Httppost"/> <add name="Httpget"/> <!-<remove name="Documentation"/>->-> </protocols> Strange is the other methods work

  • After trying, let us know if it worked or not. Hug.

  • It does not work, the error persists as Method not found but the description remains correct. It makes no sense to me that others work and only this new method doesn’t.

  • I think it may be the way to access the method. You are trying to access the method via GET, but it may be that it is configured for POST. Already tried to access it via POST?

  • via post is the second image and there it works.. So I don’t think the code is wrong if it was when I invoked the method it would have an error... This is the result of processing <Boolean xmlns="http://tempuri.org/">false</Boolean>

  • HUM.. has how to post the code?

  • I updated the question with the code

  • Guy found the error in the call I was using a ? instead of /. Thanks for the help!

  • Arrange. Hug.

Show 4 more comments

Browser other questions tagged

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