Mini server implementation in Objective C - iphone

I'm trying to implement a little server service in order to upload files via web browser to my iOS app. An example of this feature is implemented in the following app:
http://itunes.apple.com/uy/app/files-document-reader/id294150896?mt=8
seems to be very simple, but don't know where to start.
I've been also looking for clues or some sample codes about this kind of implementation with no success, but maybe just don't know how to google the problem correctly.
Any clues, guides, links, etc...?
Thanks in advance

Here is a wrapper to embed the moongoose http server in your iphone application. Another simple http server is here. The latter one is the one I used in my application, recently.
EDIT:
There's at least a third one, too.

Related

React Native Server - Is Custom Routes / Endpoints possible?

I'm new to mobile development and I know there are some fundamentally different things than the web, so I'm trying to understand RN's server. How does it work? I can't even tell if it is a node server when I look at the source code. What kind of server is it? Does anyone have any resources or high level knowledge of RN's Sever that they could please explain to me?
I'm also wondering if it's possible to create custom routes and endpoints like an express server within React Native. I realize RN doesn't use express. Does anyone have any experience doing that?
The source code is here and here
This module is an internal tool and I think it should keep that usage.
If you look at the tests file here, you can see that this server is a part of the Packager and is used to serve several elements:
Bundle JS
Assets
Tools for debugging and hot reload
I don't think it's a good idea to try to use this code inside your React Native app.

practice web service calling from iPhone without having web service?

I want to practice Web Service Calling (both SOAP and REST) for iPhone App Development. Problem is i don't have any Web Service implemented for practicing the same.
Any mock URLs (web service) for learning? At which I can have response of all types (like strings, PDFs, images, etc).
I have only basic idea of Web Service Calling from iPhone App. So, purpose is to get good understanding of WebService calling.
I have Mac and Internet, only. Nothing else.
I know this isn't the right place to ask but I could find any help by googling it.
You can get some free opensource web services on the web for your practice. Urls for free webservices are mentioned below.
Note: I am not sure if any of these will give you PDF / IMAGE as an output response of the service.
http://free-web-services.com/
http://www.webservicex.net/ws/wscatlist.aspx
It might be helpfull
Go through the step-by-step tutorial from the below link:
http://www.devx.com/wireless/Article/43209
Create an app which uses the web service at the following link: http://www.webservicex.net/WeatherForecast.asmx?WSDL, to give the weather of a US city name entered by the user. Use the method "GetWeatherByPlaceName"

Dealing with WCF in iPhone/iPad project

I'm trying to make my Monotouch app work with WCF service. Everything works fine but every now and then (10 - 30 service calls), app crashes with SIGIL. Debugger says just that.
It happens on random places.
Another employee works on iPhone app which uses same service. Same problem, but more frequent.
Everything works great when testing on simulator.
If somebody's had same problem, please help. Would using asmx service help?
Thank you all.
Cheers
WCF is a bloated option on high traffic servers at the best of days, using SOAP in a mobile application is a enough of a waste of resources that it should be considered bad practice.
ServiceStack is a much leaner and faster option that also allows you to access your same web services with ServiceStack's strong-typed, code-gen-free Service Client's using .NET's fastest JSON and JSV Text serializers.
The MonoTouch versions of ServiceStack's service clients is available separately from:
https://github.com/ServiceStack/ServiceStack/tree/master/release/latest/MonoTouch
And an example MonoTouch application that showing how to use is available here:
https://github.com/ServiceStack/ServiceStack.Examples/tree/master/src/MonoTouch/RestFilesClient
Not much an answer, but I had a similar issue. Worked for a long time to get my desktop WCF client code running on MonoTouch, only to have the app die after 10 or so calls on SIGIL.
Symbolicating and analysing the crash reports showed the app dying somewhere in the WCF stack every time. However I could not distill the issue down into a trivial, reproducable example.
In the end I used the ServiceStack framework (http://www.servicestack.net/) to throw a simple XML REST endpoint in front of my service, and called it using simple WebClient requests and some helper methods to push my objects to/from XML (DataContractSerializer was too slow).
If you have access to the server side, this may be your simplest approach.

Converting SOAP to REST?

I have a web app, that also has an iPhone and Android app using the same API. It hasn't yet been made publicly available, so I wanted to look to convert from SOAP to REST.
I was only able to find a few tutorials that go into thorough explanations of how to code a REST web service, and of those I only found the MSDN one useful. The problem is I got really confused when they started using URI data types inside the object.
My question is, if you are converting SOAP to REST, do you have to recreate all the objects to add the URI? Am I not able to just have a REST entry point, then call one of the classes that retrieve the data?
Once the REST service is made it will only be used by my mobile apps, but not the website (since that can directly access the classes), which makes me not want to change the objects to add a URI. Is that a correct assumption to make, or should the web services also be called by the website?
Sorry if these are newbie questions, but I am struggling to get my head around REST, and I haven't had much experience creating the architecture of potentially high user base apps.
If anyone is able to point me to an actual code set, that would be helpful.
Edit: I am using VS2010, coding in C# and .Net 4.
Thanks a lot,
Andy
Im doing a very similar thing right now :). Rest via wcf isnt too hard, you do have to sometimes add your endpoints in the web config and give it the [webget]/[webinvoce] attributes in the refrence.cs of the web refrence when consuming though c# which is annoying.
Here is a code set i used when getting started. There are a few more on code project too.

Using NSStream to communicate with PHP?

I'm working on an iPhone project that needs to receive data from a PHP script during execution. My first thought was to use sockets/streams on either end to connect the two, but I am having trouble finding information on how to do this from the iPhone side.
Has anyone been down this path that could point me towards some useful resources or offer some advice? The official documentation seems to be geared more towards desktop apps and uses code that doesn't seem to be supported on the iPhone (namely NSHost).
Update: The intended use of this app is to receive log messages from an executing script, so I can't use a simple HTTP request with JSON or XML. Many cases will involve the page being loaded by another client, where the script would relay/push log messages to the iPhone.
Polling is evil. You'll chew through batteries doing that.
You might consider running an HTTP server on the iPhone. Check out this blog post; it has an implementation of an HTTP server in Cocoa as well as example code for using it for two-way communication.
The PHP CURL library (can't link it because the site doesn't trust me yet, just search php.net for it) is a (relatively) simple, easy way to make http requests with a PHP script.
Why don't you just use HTTP? Create an ad-hoc protocol with XML or JSON, use POST for upstream data transmission. I'm a fan of JSON for this sort of thing, personally. The PHP, instead of returning a webpage in HTML for rendering, should just return your data in a JSON format.