WebClient method and browser giving different response
-
Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?
-
Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?
Give me code by that you are calling web service you are missing something. You can also do remote debugging for your web service by that you found exact problem for remote debugging just attach process by which you are calling your web service if that is different machine then run webserive and put break point into web service when client call web service automatically execution stop on your break point.
-
Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?
Member 2102804 wrote:
If I directly try on the browser, it works fine and giving the below response:
ERROR
How did you try on browser ?
Member 2102804 wrote:
But If I use webclient class, the response is different, and is not posting the data at all:
HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100
SUCCESS
You want to mean, when you are posting the file from your client application ?
cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article
-
Member 2102804 wrote:
If I directly try on the browser, it works fine and giving the below response:
ERROR
How did you try on browser ?
Member 2102804 wrote:
But If I use webclient class, the response is different, and is not posting the data at all:
HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100
SUCCESS
You want to mean, when you are posting the file from your client application ?
cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article
Hi... Thank you for your response, FYI, it's not a webservice, it's a normal HTTP URL Trying on browser, means typing the url in the browser's address, click below to try http://gateway.ionnex.com:8001/sendsms.aspx[^] (note this is not the url I'm testing as that url is only accesible via my server) And I'm not posting file, just parameters and values. I believe my client application is bug free as it works for other URL (API) but not this one, seems it's giving me the HTTP 200 status instead of the status from the server.