Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 11084 invoked from network); 4 Sep 2008 20:04:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Sep 2008 20:04:09 -0000 Received: (qmail 7045 invoked by uid 500); 4 Sep 2008 20:04:06 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 7031 invoked by uid 500); 4 Sep 2008 20:04:06 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 7020 invoked by uid 99); 4 Sep 2008 20:04:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Sep 2008 13:04:06 -0700 X-ASF-Spam-Status: No, hits=4.1 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Sep 2008 20:03:07 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KbL3J-000707-Ia for users@activemq.apache.org; Thu, 04 Sep 2008 13:03:37 -0700 Message-ID: <19318854.post@talk.nabble.com> Date: Thu, 4 Sep 2008 13:03:37 -0700 (PDT) From: yesnid To: users@activemq.apache.org Subject: Re: Problem with HTTP/REST In-Reply-To: <17153428.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nsimi@pelco.com References: <17153428.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org I Am getting the same error, did anyone solve this for you? or Does anyone know the solution? Please let me know. Thank you. sv75 wrote: > > I'm playng with AMQ 5.1 and HTTP/REST in demo application works strange > :( > > Posting to http://localhost:8161/demo/message/myQueue works fine, but I > have problems with GET. > It works first time, but then I always get HTTP status 204 and empty body, > with lots of pending message in queues. The following problems is always > reproduced. After restarting AMQ: > > $ wget > "http://localhost:8161/demo/message/myQueue?type=queue&readTimeout=500" > HTTP request sent, awaiting response... 200 OK > Length: 21 [text/xml] > (works fine, next message) > > $ wget > "http://localhost:8161/demo/message/myQueue?type=queue&readTimeout=500" > HTTP request sent, awaiting response... 204 No Content > (and no body) > > And then I get status 204 until AMQ is restarted. So, I can GET only > single message. I'm very confused. > I think I make some very basic error :(( > > I also wrote simple client in Python that handle cookie -- same result. > > #!/usr/bin/python > > import httplib2 > import urllib > from time import sleep > > BASE = "http://localhost:8161/demo/message/" > client = httplib2.Http(".cache") > cookie = None > > def SendMessage(queue, body): > url = BASE + queue > print "[%s] -> %s" % (body, url) > body = urllib.urlencode({"type": "queue", "body" : body}) > headers, body = client.request(url, "POST", body, > headers={"Content-type": "application/x-www-form-urlencoded"}) > print headers > > def GetMessage(queue): > global cookie > url = BASE + queue + "?" + urllib.urlencode({"type": "queue", > "readTimeout": 1000}) > print url,'->' > headers = {} > if cookie: > headers['Cookie'] = cookie > print headers > response, body = client.request(url, "GET", None, headers) > print response > try: > cookie = response['set-cookie'] > except: > pass > return body > > queue = "myQueue" > SendMessage(queue, "test message1") > SendMessage(queue, "test message2") > SendMessage(queue, "test message3") > sleep(1) > print GetMessage(queue) > print GetMessage(queue) > print GetMessage(queue) > > -- View this message in context: http://www.nabble.com/Problem-with-HTTP-REST-tp17153428p19318854.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.