Return SQS response as json - amazon-sqs

Is there a way to get the response of SQS Api as Json?
I need to do it because from the browser I need to get the information of the queue, but as it is cross-domain it needs to be in json(p)
#see Receive XML response from Cross-Domain Ajax request with jQuery

SQS does not provide a JSON interface. You could implement a proxy on your web server which returns the information in whatever format you want. That would also remove the cross-domain issue.

Related

Rails acces external API through a get request from another get request(requestception)

I have a rails client-server app that also needs to get some data from an external api with a authentication token. The authentication token is stored on my rails server.
Basically want I want to do is: when a user triggers a get request from my client-side to my server-side, I get some data from my database on the server and I want to get some data from the external api en send both sets of data as a response back to client.
But I'm not sure if it's a good Idea to send a get request from another get request like that.
Is that how this is typically done or is there a better way?
Create an ActiveJob job with the GET request to external API.
Have your client's GET request to trigger the job.
Collect all the data you need and send response back to client

IOS and SOAP server

How to work with this kind of server
http://136.243.3.6:8888/wsLoyalty/Loyalty.1cws?wsdl
I mean how to response, request and so on
You need to create a soap envelope to send request and will need to use XML parsing to read response
Refer this

Send URL encoded data instead of JSON

Is it possible to POST "url encoded" parameters to a remote web service instead of JSON or XML ?
My rails application consumes a web service which takes URL encoded parameters (content-type: application/x-www-form-urlencoded) in POST requests and give JSON answers.
Is this kind of RESTful services common ?
When you make a hit to a JSON or XML web service using Ajax then the parameters are just getting encoded as either GET or POST, and is typically sent using the application/x-www-form-urlencoded content type anyway (see http://api.jquery.com/jQuery.ajax/ for an example specific to jQuery).
So, basically, yes, it is possible to send data in any format (JSON, XML, BSON etc.) in this manner.

Getting Savon SOAP client request to become nonblocking (asynchronous)

I have a rails app which calls a SOAP service inside one of my controllers. The problem is that when the user submits the page and the app sends out the SOAP request, the user ends up having to wait for the SOAP response because the Savon gem is using a blocking call for the SOAP request.
Any idea how to tell Savon to behave asynchronously or tell rails/ruby to make this method call asynchronously?
Thanks!
To send the request asynchronously, you can send the request inside another thread.
You can read more on multithreading here

Preference of HTTP Server

I am trying my hand in server applications using Indy Internet tools.
My client sends Post data (XML) in Unicode format.
Can I convey my preference to client (HTTP Client). I prefer Text. In general can a HTTP server send its preferences to its Clients?
Thanks for any hint or help.
The problem with this is the fact, that with only one POST the server has no way to respond, until the client has already sent the data.
The solution is to make two calls: One where the client asks for the server preferences and another to send the data. The OPTIONS HTTP method can be used for this scenario.
You can handle both requests on the same URL: If the clients makes an OPTIONS request the server responds with the configuration data. (via response headers) Then the client can make a POST request on the same URL and the server handles the data appropriately.
For further information see HTTP methods and HTTP headers, especially the Accept header.

Resources