ASIHttpRequest call Restful web service? - ios

Can ASIHttpRequest call Restful web service ? I knew that Restkit is good at it.
If no,any easy way to convert ?
Can we say that ASIHttpRequest is good at calling soap based web service ?
Thanks for your comments !

ASIHTTPRequest simply does a HTTP request. Nothing more, nothing less. Since REST is also just an HTTP request, you can use ASIHTTPRequest just fine with a restful web service. It doesn't do any parsing of the response, though, so if the response is JSON you still have to parse that yourself.
You can also use ASIHTTPRequest for SOAP but you have to construct the XML by yourself (or using some other library) and parse the XML response by yourself as well. For SOAP you may want to use http://sudzc.com/ instead.

Related

Parsing HTTP multipart response body in Ruby (outside Rack)

I'm trying to use RestClient and Faraday to query an endpoint which returns multiple files in a multipart response. How do I parse the multipart envelopes in the response body? Rack::Utils::Multipart.parse_multipart would have done it, but in my case, this is outside of Rack. I'm open to using a different HTTP client if its helps.
Almost none of the popular HTTP clients, in almost any language, handle multipart responses from a server. In fact I'd be surprised if you can easily find HTTP servers with baked in multipart response capabilities. It's just not a common use case.
You'll find the converse true though, most HTTP servers handle multipart responses built from clients.
The good news is that "multipart" is just content type like XML or JSON, so you should be able to attach any old multipart parser to the response body after you've made the request with your favorite HTTP client.
Some parsers to consider:
https://github.com/danabr/multipart-parser
Rack::Multipart::Parser
Shoehorn your data into Rack::Utils.parse_multipart

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

How to send data to server in xcode?

I am a beginner to ios development.
Can anyone tell me how to send data to server in xcode?
I have a requirement where I need to send device information to a server.
You need to first work out what kind of API the server you're talking to has exposed
Most modern web applications expose a Rest API (although I can only speculate as to what the server you mention is exposing). If Rest, then a good starting point should you not wish to write your own network layer is to use Restkit: https://github.com/RestKit/RestKit
If not Rest, then you need information on what the backend API is, and then go from there...
In it's most basic format you'll need to look at using NSURLRequest and NSURLConnection
NSURLRequest : Post data and read the posted page
http://codewithchris.com/tutorial-how-to-use-ios-nsurlconnection-by-example/

Best wrapper for simultaneous API requests?

I am looking for the easiest, simplest way to access web APIs that return either JSON or XML, with concurrent requests.
For example, I would like to call the twitter search API and return 5 pages of results at the same time (5 requests). The results should ideally be integrated and returned in one array of hashes.
I have about 15 APIs that I will be using, and already have code to access them individually (using simple a NET HTTP request) and parse them, but I need to make these requests concurrent in the easiest way possible. Additionally, any error handling for JSON/XML parsing is a bonus.
I'd recommend Weary.
It handles multiple simultaneous asynchronous requests by spawning a thread for each request, and with it you can write API connectors that are readable and DRY. On top of that it has a built in .parse method which works with JSON or XML responses.

Sending XML over HTTP with Rails

I am dealing with a third-party api here and I need to send HTTP Post request represented in XML. How should I go about doing this in Rails? Which library/method if any will allow me to do this?
Try net/http package, in particular post method. There're examples too.
As to xml part, you can send any data you want as long as it's string.
A good starting point would be Net::HTTP library: http://stdlib.rubyonrails.org/libdoc/net/http/rdoc/index.html

Resources