Closed

vb.net webservice rebuilt using content body instead of parameter

This project received 6 bids from talented freelancers with an average bid price of $54 USD.

Get free quotes for a project like this
Employer working
Project Budget
$10 - $30 USD
Total Bids
6
Project Description

THIS PROJECT IS URGENT, ONLY BID IF YOU CAN FINISH IN 2 HOURS.

I need a web service, similar to the one posted below to accepts JSON data and saves it to a MS SQL table. It must accept multiple rows and multiple columns.

IMPORTANT, it must accept the data through the body of the POST instead of a parameter. The current sample code (BELOW) works fine, but I need to submit the data through the strData parameter. I need to submit through the body. It should be something like: <HttpPost> Public Function UploadTest(<FromBody()> ByVal strInput() As clsTest) as string

I cannot give you access to my server. I will give you a sql data structure and sample code. You will deliver a full .net solution that I can test with, then I will migrate to my environment.

table structure:

CREATE TABLE [dbo].[tblTest](

[intCol1] [int] NULL,

[strCol2] [nvarchar](50) NULL,

[dteCol3] [date] NULL

) ON [PRIMARY]

Sample XML to upload:

[{"intCol1":13,"strCol2":"13 Test","dteCol3":"12/13/1997"}]

Sample Code:

<WebMethod()> _

Public Sub UploadTestData(strData As String)

Try

If [url removed, login to view](strData) Then

[url removed, login to view]("No Data Passed")

Return

End If

Dim lst As List(Of clsTest) = [url removed, login to view](Of List(Of clsTest))(strData)

Dim conn As New [url removed, login to view]([url removed, login to view]("ConnString2").ConnectionString)

If [url removed, login to view] <> [url removed, login to view] Then

[url removed, login to view]()

End If

Dim nCount = 0

If lst IsNot Nothing And [url removed, login to view] > 0 Then

For j = 0 To [url removed, login to view] - 1

Dim strSQL = "insert into tblTest([intCol1],[strCol2],[dteCol3]) values (" & _

lst(j).[url removed, login to view] & ",'" & lst(j).[url removed, login to view] & "','" & lst(j).[url removed, login to view] & "');"

Dim cmd As New SqlCommand(strSQL, conn)

Dim res = [url removed, login to view]()

If res = 1 Then

nCount = nCount + 1

End If

Next

[url removed, login to view]()

[url removed, login to view]([url removed, login to view]() + " Record Successfully Added.")

End If

Catch ex As Exception

[url removed, login to view]([url removed, login to view]())

End Try

End Sub

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online