Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 52235 invoked from network); 5 Sep 2008 11:10:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2008 11:10:18 -0000 Received: (qmail 95872 invoked by uid 500); 5 Sep 2008 11:10:15 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 95857 invoked by uid 500); 5 Sep 2008 11:10:14 -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 95846 invoked by uid 99); 5 Sep 2008 11:10:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 04:10:14 -0700 X-ASF-Spam-Status: No, hits=4.7 required=10.0 tests=HTML_MESSAGE,SPF_HELO_PASS,SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [194.247.192.226] (HELO EUnet.yu) (194.247.192.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 11:09:13 +0000 Received: from [194.247.199.205] (billingdev-hotspot.eunet.co.yu [194.247.199.205] (may be forged)) by EUnet.yu (8.13.6/8.13.6) with ESMTP id m85BALgH010833 for ; Fri, 5 Sep 2008 13:10:22 +0200 Message-ID: <48C1135E.4000303@ttmsolutions.com> Date: Fri, 05 Sep 2008 13:09:18 +0200 From: Dejan Bosanac User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: REST: eternal HTTP status 204 References: <13269025.post@talk.nabble.com> <19319033.post@talk.nabble.com> In-Reply-To: <19319033.post@talk.nabble.com> Content-Type: multipart/alternative; boundary="------------070005040100000109000302" X-EUNET-AVAS-Milter-Version: 2.0.0 X-AVAS-Virus-Status: clean X-AVAS-Spamd-Symbols: BAYES_50,HTML_30_40,HTML_MESSAGE,HTML_TITLE_EMPTY,UNPARSEABLE_RELAY X-AVAS-Spam-Score: 0.6 X-AVAS-Spam-Level: x X-Virus-Checked: Checked by ClamAV on apache.org --------------070005040100000109000302 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit The problem is that you have to keep your HTTP session between your GET requests. So, try something like wget --save-cookies cookies.txt --load-cookies cookies.txt --keep-session-cookies http://localhost:8161/demo/message/TEST1?type=queue if you're playing with wget, or something similar in your scripting code (or just use Stomp ;)) Cheers -- Dejan Bosanac http://www.ttmsolutions.com - get a free ActiveMQ user guide ActiveMQ in Action - http://www.manning.com/snyder/ Scripting in Java - http://www.scriptinginjava.net yesnid wrote: > I am having the same issue, what is the solution? > > sv75 wrote: > >> I'm trying simple python program to using ActiveMQ via HTTP. >> I managed to send message via HTTP/POST, but have problems getting them >> via GET (or DELETE). While first request receive message (with HTTP status >> 200), all other requests has status 204 (not modified?) and no body after >> long delay (~5 seconds). It start working after restaring amq - but only >> one message again. What I'm doing wrong? Any advices, please? I see the >> same behavior with web browser when using "send/recieve message" in demo >> so i don't think it is my program. >> >> I tried 4.1.1 and 5.0 snapshots - same behavior. And using web browser JDK >> 1.6, Ubuntu 7.04. amq working under root. >> >> ===== >> #!/usr/bin/python >> import httplib2 >> import urllib >> from time import * >> >> BASE = "http://localhost:8161/demo/" # AMQ 5.0 >> # BASE = "http://localhost:8080/activemq-web-demo/" # AMQ 4.1 >> client = httplib2.Http() >> dtype = "queue" >> >> def SendMessage(queue, body): >> url = BASE + "message/" + queue >> print "[%s] -> %s" % (body, url) # "destination": queue, >> body = urllib.urlencode({"type": dtype, "body" : body}) >> return client.request(url, "POST", body, >> headers={"Content-type": "application/x-www-form-urlencoded"}) >> >> def GetMessage(queue, method): >> url = BASE + "message/" + queue + "?" + urllib.urlencode({"type": >> dtype, "timeout": 1}) >> print url,'->' >> headers, body = client.request(url, method, None, None) >> print 'STATUS:',headers["status"] >> return body >> >> queue = "queue22" >> SendMessage(queue, "test message2") >> SendMessage(queue, "test message3") >> SendMessage(queue, "test message4") >> sleep(1) >> print GetMessage(queue, "GET") >> print GetMessage(queue, "GET") >> print GetMessage(queue, "GET") >> >> >> > > --------------070005040100000109000302--