How to get messages from ActiveMQ using REST requests - rest

I am sending message to queue using following request:
POST http://localhost:8161/api/message/PR?type=queue
Host: localhost:8161
Authorization: Basic YWRtaW46YWRtaW4=
User-Agent: curl/7.48.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 12
Then I go to the admin UI and I see the queue and the message there.
Now the question, how can I retrieve this message?

Related

WSO2 IS REST request XACML

I find example usage API
https://localhost:9443/api/identity/entitlement/decision/pdp
on
https://medium.com/#gdrdabarera/how-entitlement-management-works-with-rest-api-via-xacml-in-wso2-identity-server-5-3-0-7a60940d040c#.taxf6cvmx
Which request should I send to
https://localhost:9443/api/identity/entitlement/decision/entitlements-all
To get all the access rights?
I suggest the following request:
POST /api/identity/entitlement/decision/entitlements-all HTTP/1.1
Host: localhost:9443
Authorization: Basic YWRtaW46YWRtaW4=
Content-Type: application/json
Accept: application/json
{
"identifier": "",
"givenAttributes": []
}

URLSession on Linux giving different result than on iOS

I've got a simple class making a HTTP POST request (to a Neo4j server, but that shouldn't matter) using URLSession, and an integration test that tests that it succeeds.
Through Xcode, via the iOS simulator, I can run this test a million times - it succeeds every time.
However, when I run swift test on Ubuntu Linux (I use the docker image provided by IBM) then I very often will get a test failure saying I got a 401 response.
Replicating that via cURL in the container does not fail at all, so I do not believe this to be a problem with my container.
I have added a packet dump (that I inspect via Charles Proxy) where our of 15 test runs, 7 test runs (and thus 7 requests) fail. All of the failed requests complain that no authentication header was supplied. And from the dump, that is correct, the dump does not contain the authentication header for those requests that fail. But why not? In fact, all of the header flags are different: a successful run has these headers:
POST /db/data/cypher HTTP/1.1
Host: 192.168.0.18:7474
Accept-Encoding: deflate, gzip
Authorization: Basic bmVvNGo6c3RhY2swdmVyRmxvdw==
Content-Type: application/json; charset=utf-8
Accept: application/json; charset=utf-8
Connection: keep-alive
User-Agent: urlsessionTestPackageTests.xctest (unknown version) curl/7.35.0
Content-Length: 135
while an unsuccessful one has these:
POST /db/data/cypher HTTP/1.1
Host: 192.168.0.18:7474
Accept: */*
Accept-Encoding: deflate, gzip
Connection: keep-alive
User-Agent: urlsessionTestPackageTests.xctest (unknown version) curl/7.35.0
Content-Length: 135
All the 200 results have the same headers, and all the 401 results have the same headers. Can you see anything in my code that should warrant such a random request?

Fiddler soap action in proxy client

This is what fiddler has to say for a request I am trying to make to an external webservice
Request:
POST https://service100.emedny.org:9047/MHService HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: service100.emedny.org:9047
Content-Length: 7933
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Response: HTTP 500 Internal server error.
Miscellaneous: X-backside-transport: FAIL FAIL
TextView: Faultcode-Rejected by policy from client
Could soap Action =”” be the probable cause of this Faultcode? I am sure a client handshake was established
Now this is the trace viewer svclog
THank you

AbsoluteURI support in Play Framework 2.1

As stated here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html
To allow for transition to absoluteURIs in all requests in future versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form in requests, even though HTTP/1.1 clients will only generate them in requests to proxies.
I have client which sends POST-requests to my play-2.1.1 server. He sends it this way:
POST http://172.16.1.227:9000/A8%3aF9%3a4B%3a20%3a89%3a40/1089820966/ HTTP/1.1
Content-Length: 473
Content-Type: application/json
Date: Thu, 25 Apr 2013 15:44:43 GMT
Host: 172.16.1.227:9000
User-Agent: my-client
...some data...
All requests are rejected with "Action not found" error. The very same request which I send using curl is just fine and the only difference between them is curl send it with relative URI:
POST /A8%3aF9%3a4B%3a20%3a89%3a40/1089820966/ HTTP/1.1
Accept: */*
Content-Length: 593
Content-Type: application/json
Host: 172.16.1.227:9000
User-Agent: curl/7.30.0
I created the following simple workaround in Global.scala:
override def onRouteRequest(request: RequestHeader): Option[Handler] = {
if (request.path.startsWith("http://")) {
super.onRouteRequest(request.copy(
path = request.path.replace("http://"+request.host, "")
))
} else super.onRouteRequest(request)
}
And with this workaround all requests from my client are handled correctly.
So, is there more straightforward way to do it in Play Framework or thats the only way?
Thanks to #nraychaudhuri Play 2.2 supports absoluteURI-style request headers.
Here's the issue and pull request: https://github.com/playframework/playframework/pull/1060

Server does not accept my multipart/form-data

I try to upload an image to my webservice from my iphone application. The webservice is programmed in php. I have to send the image along with a device_id as multipart/form-data.
Something is wrong with my request because the server does not accept my device_id (invalid format). I am 100% positive that the device_id is correct because it works with my other requests.
I think there is something wrong with my request structure because Charles proxy cannot decode the multipart form-data.
Here is my request (sniffed with charles proxy):
POST /api/profile/update HTTP/1.1
Host: THE_URL
User-Agent: SeduceMe/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Content-Length: 6639
Accept: */*
Content-Type: multipart/form-data; boundary=---------------------------255141413922088
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=tlcpnqugcpgs0skh3l2ip9ujh7
Connection: keep-alive
Proxy-Connection: keep-alive
---------------------------255141413922088
Content-Disposition: form-data; name="device_id"
mgs2AHyvfIcSXHSKE+0eHA==
---------------------------255141413922088
Content-Disposition: form-data; name="form[file]"; filename="avatar.jpg"
Content-Type: image/jpeg
RAW_JPEG_DATA
---------------------------255141413922088--
there is a great wrapper to post form/data. it is ASIHTTPRequest
please look at ASIFormData
thanks/