[rabbitmq-discuss] Exchange details are not set while creating with Put Method in c#

Tobias Gutzmann Tobias.Gutzmann at ist.com
Tue Nov 26 13:37:01 GMT 2013


You're probably using Windows? If so, you must encode the command line arguments to curl differently to get rid of the "400 Bad Request" error message, see https://www.rabbitmq.com/ha.html (far down on the page) and http://rabbitmq.1065348.n5.nabble.com/Http-API-new-user-td29013.html#message29088


-----Ursprungligt meddelande-----
Från: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] För Lijo Sebastian
Skickat: den 26 november 2013 12:58
Till: Simon MacMullen
Kopia: Discussions about RabbitMQ
Ämne: Re: [rabbitmq-discuss] Exchange details are not set while creating with Put Method in c#


I tried with the curl  (RabbitHub Way)

curl -v -X PUT -H "content-type:application/json" -d '{"type":"direct", "durable":true}' http://guest:guest@servername:15670/endpoint/x/foo1231

and Got the same result: Created but of fanout type.

curl: (3) [globbing] unmatched close brace/bracket at pos 13
* timeout on name lookup is not supported
* About to connect() to servername port 15670 (#0)
*   Trying
* connected
* Connected to servername  ( port 15670 (#0)
* Server auth using Basic with user 'guest'
> PUT /endpoint/x/foo1231 HTTP/1.1
> Authorization: Basic Z3Vlc3Q6Z3Vlc3Q=
> User-Agent: curl/7.26.0
> Host: servername:15670
> Accept: */*
> content-type:application/json
> Content-Length: 14
* upload completely sent off: 14 out of 14 bytes < HTTP/1.1 201 Created < Server: MochiWeb/1.0 (Any of you quaids got a smint?) < Location: http://servername:15670/endpoint/x/foo1231
< Date: Tue, 26 Nov 2013 11:48:41 GMT
< Content-Length: 0
* Connection #0 to host rabbitmq.citrus.com left intact
* Closing connection #0

When Tried RabbitMQ API Way :

curl -i -u guest:guest -H "content-type:application/json"  -X PUT -d '{"type":"direct","durable":true}' 

Result :
HTTP/1.1 400 Bad Request
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Date: Tue, 26 Nov 2013 11:56:28 GMT
Content-Type: application/json
Content-Length: 43


Lijo Sebastian
Senior Software Engineer
Citrus Informatics (India) Pvt Ltd.
-----Original Message-----
From: Simon MacMullen
Sent: Tuesday, November 26, 2013 4:07 PM
To: Lijo Sebastian
Cc: Discussions about RabbitMQ
Subject: Re: [rabbitmq-discuss] Exchange details are not set while creating with Put Method in c#

On 26/11/2013 10:12, Lijo Sebastian wrote:
>               Yes i do read the response.
>     The response says with StatusDescription Created.

Hmm. We only reply with 201 Created to POST requests - a successful PUT returns a 204 No Content. So I wonder what's going on.

Can you reproduce the problem with curl or similar?

> Regarding the coding, i may or may not be a non-c# expert, but this is 
> the basic format of creating a HttpWebRequest in c#.

Sorry, I meant *I* was not a C# expert!

Cheers, Simon 

rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com

More information about the rabbitmq-discuss mailing list