Click here to Skip to main content
14,578,986 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
Hi Friends,
I am new to web services, I have a task to send the JSON content to particular URL using post method. relevant JSON and tried code available below, I have faced the exception only. anyone have a better solution for this.

You can provide c# solution also, I will convert in my end. thank you

What I have tried:

''My.Settings.JsonViewerURLhttp://176.26.181.67/ProcessTool/api/processBook
Using clnt As WebClient = New WebClient()
            clnt.Headers.Add("Content-Type:application/json")
            clnt.Headers.Add("Accept:application/json")
            Dim res As VariantType = clnt.UploadString(My.Settings.JsonViewerURL, JsonConvert.SerializeObject(jsonvalue))
            Console.WriteLine(res)
        End Using
        Exit Sub


''Json Content
''{"ToolName":"ProcessTool","Version":"3.3","TimeStamp":"2020-04-10 19:16:26","UserName":"User1","BookNumber":"485_1_01","Machine":"CHN-152","StartTime":"19-15-29","EndTime":"19-16-26","Meta":"ProcessMeta.xml","InputFile":[{"FileName":"InfileForTest.docx","Format":".docx","PageCount":"214"}],"OutputFile":[{"FileName":"485_1_FM.docx","Component":"FM","Part":"FM","Title":"","Number":"","Format":".docx","PageCount":"18"},{"FileName":"485_1_CH1.docx","Component":"CHAPTER","Part":"","Title":"Ch1Title","Number":"1","Format":".docx","PageCount":"33"},{"FileName":"485_1_CH2.docx","Component":"CHAPTER","Part":"","Title":"Ch2Title","Number":"2","Format":".docx","PageCount":"15"},{"FileName":"485_1_CH3.docx","Component":"CHAPTER","Part":"","Title":"Ch3 Title","Number":"3","Format":".docx","PageCount":"24"},{"FileName":"485_1_CH4.docx","Component":"CHAPTER","Part":"","Title":"Ch4Title","Number":"4","Format":".docx","PageCount":"42"}]}
Posted
Updated 11-Apr-20 8:04am
v2
Comments
MadMyche 11-Apr-20 10:27am
   
It would b helpful to now what Exception you are seeing

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100