Is it possible to make JSON requests using Fiddler's Request Builder?

asp.netWeb ServicesJson

asp.net Problem Overview


I keep getting a Request format is invalid.

Here's the raw http that gets sent:

POST http://x.x.x.x/ws/MyWebService.asmx/TestEvent HTTP/1.1
contentType: "application/json; charset=utf-8",
  dataType: "json",
  data: {"strData":"1"}
Host: x.x.x.x
Content-Length: 4

Any help is greatly appreciated.

Thanks!

asp.net Solutions


Solution 1 - asp.net

I think it should be more like this:

POST /ws/MyWebService.asmx/TestEvent HTTP/1.1
Host: x.x.x.x
Content-Type: application/json; charset=utf-8
Content-Length: 15

{"strData":"1"}

And it is in the connection that you specify which server to connect to.

Solution 2 - asp.net

In addition to Alxandr, I want to highlight the importance of "charset=utf-8". If you want to send a request body with some parameters, content type must be like this:

Content-Type: application/json; charset=utf-8

And request body should be like this, { "strData":"1", "strData2":"2", ..., "strDataN":"N" }

there is no need something like "data":{ ... }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionV-ManView Question on Stackoverflow
Solution 1 - asp.netAlxandrView Answer on Stackoverflow
Solution 2 - asp.netRoronoaZoro04View Answer on Stackoverflow