[rabbitmq-discuss] Occurs 404 or 405 http error when use RabbitMQ HTTP API
uniguyit
zhujun.corp at gmail.com
Sat Jan 19 15:04:37 GMT 2013
I use .NET Code 's Webclient and Firefox's HTTPRequester to call RabbitMQ
HTTP API ( for getting queue messages) , it not work , and occurs 405 or 405
ERROR, or : The requested document was not found on this server!!
all parameters are correct.
but i use FireFox to post the same parameters ,the same URL i can get
correct RabbitMQ Message!
Those are code:
string serverIP="192.168.68.4";
string localIP="172.16.1.1";
int port=15672;
string apiaddr ="/api/queues/%2F/" + localIP + "/get";
string requestURL="http://" + serverIP + ":" + port + apiaddr;
string
postbody="{\"vhost\":\"/\",\"name\":\"172.16.1.1\",\"truncate\":\"50000\",\"requeue\":\"true\",\"encoding\":\"auto\",\"count\":\"1\"}";
Console.WriteLine(requestURL);
Console.WriteLine(postbody);
WebClient wc=new WebClient();
//wc.Headers["Connection"]="keep-alive";
wc.Headers["Content-Type"]="application/json; charset=UTF-8";
wc.Headers["Pragma"]="no-cache";
wc.Credentials=new System.Net.NetworkCredential("guest","guest");
string result= wc.UploadString(requestURL,"POST",postbody);
---> RMQServer 3.0.1 Version and 3.0.1 .NET Client DLL.
--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Occurs-404-or-405-http-error-when-use-RabbitMQ-HTTP-API-tp24585.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
More information about the rabbitmq-discuss
mailing list