URLConnection - Reply

Hi,
Below is my code for HTTP Post

Dim URL1 As String = “http://dev-iwk-cms.ciot.my/dev/dms
WebConnection1 = New URLConnection1
WebConnection1.SetRequestContent(postData, “application/json”)
URL1_Reply = WebConnection1.SendSync(“POST”, URL1.Trim,30)

postData is JSON which is I need to send that end point.

The issue is, I get the reply like below when run this program

> <!DOCTYPE html>
> <html lang="en">
> <head>
> <meta charset="utf-8">
> <title>Error</title>
> </head>
> <body>
> <pre>Cannot GET /dev/dms</pre>
> </body>
> </html>

But when I check in Postman (Testing tool) I get the proper response which is server send.

you need to make sure the URL is clean (no spaces, url encoded etc) it seems you have a space at the end of the url.

Thanks for response , actually in my code there is no space on end of URL.

That’s the same response my Browser (Chrome on Windows) brings


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /dev/dms</pre>
</body>
</html>

Maybe postData is malformed or an Encoding Issue with the postData Content?

There are lots of things we don’t know about such endpoint. It needs the “how to use” info from its “users manual”. Some headers may be missing, authorization schemas could be faulty, etc.

My bad… Server reject the Http request, only allow https. that’s why getting error. Thanks for all . sorry tgo wasting your time.