[rabbitmq-discuss] Occurs 404 or 405 http error when use RabbitMQ HTTP API

Simon MacMullen simon at rabbitmq.com
Mon Jan 21 11:04:40 GMT 2013


Hi. I ran your example code in Visual Studio 2008 and looked at 
Wireshark. It seems like WebClient is modifying 
"/api/queues/%2f/blah/get" to "/api/queues///blah/get", which is 
logically the same as "/api/queues/blah/get". As far as I can see this 
is a bug in WebClient - RFC 1738 section 2.2 says not to do this.

Unfortunately I don't know if Microsoft would listen to a bug report. 
Your best workaround may be to rename the virtual host. Sorry about this.

Cheers, Simon

On 19/01/13 15:04, uniguyit wrote:
>
> 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.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list