Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How to call WebMethod dynamically without adding VS Webreference.

$
0
0

I have a code that works great when I add web reference, and on my code behind all the properties and signatures are all exposed. I can do inserts easily as you can see below

 Dim soap As New ServiceNowRef.ServiceNow_incident
        Dim cred As New System.Net.NetworkCredential("xxx", "xxxxx")
        'Dim soapclient As New We
        Dim msg As String = String.Empty
        Dim insert As New ServiceNowRef.insert
        Dim insertResponse As New ServiceNowRef.insertResponse

        soap.Credentials = cred
        insert.u_ticketnumber1 = Request.Form("ticketnumber1")
        insert.u_ticketnumber2 = Request.Form("ticketnumber2")
        insert.u_ticketstatus = Request.Form("TicketStatus")
        insert.u_ticketstatusnotes = Request.Form("TicketStatusNotes")

        Try
            updateResponse = soap.insert(insert)
            msg = "Incident inserted"
        Catch ex As Exception
            msg = "Incident Not inserted:" & ex.ToString
        End Try

The code requirement has changed and instead of doing through webreference, I need to perform same function like INSERTing a record to an API, the URL & other references should be defined on the same page.
How do I achieve that? Is it possible without adding too much complexity. Can you show me some samples?

Thank You


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>