soap connection through jquery in phonegap? - iphone

is it possible to do cross domain through j query in phone gap? I know cross domain will be supported in phone gap. can we do SOAP,REST web services through phone gap using j query?

Yes you can use web services calls in phonegap. When I developed for iphone using phonegap we used a ton of web service calls to update and push and pull data to our servers.
http://api.jquery.com/jQuery.ajax/
or post methods would work.
Just look for examples on the web to jquery ajax calls i just used json to push and pull data but implementing a soap call shouldn't be that much harder.

it is possible, if you upgrade your Webservices to handle JSONP calls instead of JSON/SOAP. With the help of JQuery.Ajax, you can call these services remotely.
If you're using .Net Webservices, here's a fine example:
http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx

Related

can we create a web service using objective c

In my iphone application I am calling (by SOAP post method) a web service which is written in .net and hosted on a server, and its all working fine. But my doubt is, can we write a web service in objective c? And host it on a server? so that we should be able to access it from any of the platforms like .net, php and objectiveC.
I read a fantastic tutorial regarding this question some time ago here.
To be honest, it can be quite difficult to really use this in a productive environment. If you want to get all the features and tools Apple gives to you (what seems to be the intention of your question), you'll have to use a Mac in order to run your service afterwards.
In my opionion using PHP for example (if you need a db also backed up by MySQL) is much easier. Almost all hosters support it and you won't have to worry about setting up a bunch of macs and connecting them via solid and stable cables to the internet (and with that: guarantee availability).
Yes. A web service is just some application that can provide a service over the web. As you can create an application in Objective C, it can be a web service the same as made in any other language.
You can make it run on any server where you have an objective C compiler, however, the framework you use may restrict your choices to the server (ie, you can write objective C on windows, but you wouldn't be able to use the NS framework)
Web services are not limited to a programming language, however you do need to find if there is any framework using objective-c can run on specific server. For example, iiS allows you to use Asp.net which could be implemented using C# or VB.Net.
From the clients who will consume web services, they don't have to be a specific type of device. I think that's the point of web services. The messages travel in between is formatted. For example, a SOAP message is using xml, and that would ensure the message travel on HTTP. Therefore no matter you use iPhone or Android or Blackberry, you should have no problem to make web service calls.
So in general, I think you have to see what kind of web services you want to create, and then see if Apple(I assume) can provide you with a good framework to do it. In terms of client side, as long as your web services are using XML or JSON, it should be well supported.
Hope it helps.

Sending data to RESTful web services from iOS app

I am facing a challenge to upload & download data, to and from the server using RESTful web services.
Is it possible to use a RESTful service client, if possible any way to achieve that in an iOS app to send data to the service.
#Ajay: As Claus mentioned there are number of public frameworks/wrappers are there, you can use them for RESTful service interaction from your code. The one I frequently use is ASIHttpRequest, quite handy and easy to use. There are enough examples out there with ASIHttpRequestyou can use it as reference.
Let me know if that helps.
You question is not clear. Do you need to push data from the server to the iOS app using a REST service?
If so, REST does not provide an interface for push. (It only provides a client->server Create/Read/Update/Delete API).
Take a look at ASIHTTPRequest or use RestKit for some more advanced stuff!
RestKit works really nice!

Blackberry and RESTful services

I'm looking to develop a blackberry application to consume a RESTful service. At the moment we plan to develop a REST layer which we will use to perform searches on a back end database and return the results as JSON.
I have used the Jersey framework ( http://jersey.java.net/ ) for consuming (and developing) REST layers in the past.
This is the first time we plan to develop such an app for a blackberry. From looking around I'm not sure if jersey is supported on the blackberry for consuming RESTful services.
So I'm wondering could someone offer some advice (on jersey or any other purpose built JARs) for using RESTful services on Blackberry? Otherwise we will have to build from scratch the code for consuming the RESTFul service. Or even use SOAP which I prefer not to have to do if possible.
Thanks,
John
Take a look at the JSON.org website, they have lib in Java to parse JSON data(I'v manage to make it work for BlackBerry without to much modifications.
The only thing left to do is a connection to the web service by passing the parameter you need to it. And then parse the response with the JSON lib to rebuild your data model in your native client.
And please don't use SOAP for mobile application.
Please read RIM doc for socket
You can use a httpConnection too

iPhone app and server communication

We have a web-based BI reporting product. We have exposed certain webservices which mainly return html content and do authentication.
We are in a initial process of developing an iPhone App, which will interact with these services and get data on iPhone.
There are couple of things we need to make sure before we start with the actual development process...
1) Should we use SOAP or REST (Will have to write the server part in Java) for the communication between iPhone and our web-application?
2) If we use SOAP, Can you suggest something, which will effectively create web services stubs in Objective-C.
3) In either case (SOAP or REST), what security mechanism is suggested by Apple?
We want to know your thoughts on the best and effective way communication could be done between iPhone app and backend servers (mostly written in Java)
Thanks in advance.
If it is an option, I'd use REST
Never did it, but may this will help: http://abhicodehelp.blogspot.com/2010/12/handling-soap-with-iphone.html
I'd do any HTTP-Communication using ASIHttpRequest. It is SSL-capable
In my apps I use simple URL requests returning XML / Cocoa-touch plists over https. I guess that's called "REST" -- it's simple and quick to implement. There are long flame-fests over SOAP vs. REST -- I just use this technique and get my apps done :)

What common backend can be accessed securely from an iPhone and Android application?

I'm thinking about creating an application for the iPhone and Android that will need to access a common backend to retrieve account information. Can both access a web service over https? What other way would allow me to have one interface to the backend that is accessible by both?
They both work over http and https which is a common enough protocol. I would suggest you go with a RESTful web service so you expose your service via URI's like http://www.myservice.com/weather/zip/98007 which would return an XML blob that can be parsed by the client.
if you are starting from nothing, i'd definitely go with RESTful service that returns/accepts JSON... there are plenty of libraries for both platforms that will accept JSON and turn it into arrays and dictionaries.
I'd recommend using a RESTful web service backend, which is all standard HTTP and/or HTTPS. If you can use Ruby on Rails, its default scaffolding will get you about 99% of the way there and for the iPhone there is an open source project called ObjectiveResource that will automate your communication with this Rails backend. I haven't investigated yet what options are available on Android but since it is all simple HTTP it should be straightforward. I am not the maintainer of ObjectiveResource but I have contributed some code. You can check it out here:
http://iphoneonrails.com
One good approach I have seen used with other services is to write the backend in such a way that it can feed data back in different types - for Android an XML response is best, but for the iPhone sending back plist data is preferred (though it can also work with XML if required). In both cases it's easier to simply POST updates back to the server than to wrap an update in XML.
Both platforms should be able to use whatever form of authentication you wish to use, the iPhone I know supports all methods of HTTP authentication.