server side for mobile application in java me - web-services

Im making mobile application in java me and I want to have server side from where Ill get some information for the application (not to have much information in xml file in the application).
I dont have much experience with servers, so I would like to know how to deal with it.
Probably I should make some web services.
Im working in NetBeans 6.7
Thanks in advance!
Milan

Assuming you want to stick with Java, I would implement your server side as a simple Servlet. If all you want to do is send an XML file to the client I think using a proper web services stack is probably overkill and will over complicate things.
Using this approach your mobile app simply makes an HTTP connection to your Servlet, which responds with your XML file.
In fact, if it's a static XML file you don't need any kind of server side code, any web server would suffice.

The Glassfish application server that probably comes with Netbeans will let you run a Java servlet on your local computer.
Accessing it from a J2ME emulator running on the same computer is easy.
Accessing a servlet from a MIDlet running on a real mobile phone is more complicated.
I would suggest looking at Google App Engine for easy deployment of a test server that can be accessed from a mobile phone.

I recommend you to use Http Post instead of Web services. Some mobile devices does not support web services (defined in JSR 172)

Related

When to use standalone web service approach

I just started learning web services. In bottom up approach, I have found some examples without being deployed in any application server. I mean a standalone web service application.
Here is an example of such type.
I have also given a try and done a walk-through of deployable simple web service examples.
So far to my learning of web services, I got to know that firstly, bottom-up- approach is not recommended. Now, in bottom-up approach, this standalone web service. When is it applicable to follow standalone web service procedure?
Endpoint.publish();
I guess, this approach is provided just for beginners and not to follow as a real-time practice. Is my interpretation correct?
I would make my application as a standalone web service if it will have multiple clients like:
Web Client via a web browser
Mobile App Client
Desktop Client
Then I could build every one of them alone using whatever the technology I prefer, and make it consumes my standalone web service.
For example, You could imagine the guys behind Twitter started developing it by building their core system as web service, then they build an independent web interface application for it, then they built the Twitter Android and iPhone APP, and another one came and introduced a Twitter Desktop client like Tweetbot and TweetDeck ... etc

Do I need a web service in this case? When do we use them?

my issue is about web services and all the stuff around that. I've developed a java web app, using hibernate (to connect with a mysql DB), jsf and primefaces. The only thing I have to show to the user is the index.xhtml which will search a data in a database. All of this is running on my PC with my local apache server.
But a doubt comes to my mind when I wonder if I deploy this web app in the apache server of the company, do we need something such as a web service o something like that o they just can access to the index.xhtml and start the queries?
Sorry for this but I'm totally new repesct web services, web app, web server and all these stuff.
PS. So, when do we use web services? and web server?
Thanks in advance :)
A web service is typically used as an API that might be integrated into another application. For example, if you have a way to accept payment information. You could make that a web service that would let some other application (e.g. an auction site) make calls into your web service to do some work.
Think of it a bit like a DLL that is accessible on the web. It won't have an interface, it is a collection of methods that either return data or execute some code. It will not return a UI.
So when you use a web service would be a similar question to when you need to break code out into a separate assembly.
On your specific question above, you would not need a web service, if your web application is doing everything you need it to do, then all you need is a web application.

Could Web server and Application server be developed separately?

My friend has developed a recommend system in C++, now we want to make a web information system based on his work. As we both do not have no Web technology knowledge, I have some questions:
If we want to develop a web site which based on this recommend system, we should implement the recommend system in the application server and make a web server that could return the pages, right?
Then what web server we should use or use what technique to develop a web server to call the function in the recommend system? How the web server communicates with the application server?
Some web frameworks, such as Django, does it act as web server or application server or it is both?
As we have so much basic questions, do you have some books or website to recommend?
You can think of your C++ app as a service that your Django app can execute to return values to your users. You could easily execute any application on the same server as Django and capture the response or you could create a thin HTTP API and put your C++ app on its own server and call it by HTTP from your Django app to make requests for your users.
https://www.djangoproject.com/ is a great place to start.

Is there a way to access Microsoft OCS Directory/Presence information using a web service?

We are working on a client app that should search and download directory information from Microsoft OCS server (OCS old as well as Lync).
Does OCS provide web services type api?
From what I understand, the client needs to do sip handshake before it can do directory related queries.
Having dependency on sip stack is not desirable.
So I am wondering if there is a way (like SOAP web service or something like that) to do it.
The client is a C++ client with access to gSoap or curl type library running on Linux platform.
Thanks for your help.
No, there is no web service out of the box that gives you what you need.
I thin your best bet would be to build a UCMA application that would sit on an application server inside your OCS/Lync infrastructure. You could then build a web service to access this.
For OCS 2007, you'd need to use UCMA 1.0. For OCS 2007 R2, UCMA 2.0 and for Lync, UCMA 3.0

Java ME consuming .NET Web Service the safe way

I'm developing an application for Blackberry that consumes .NET Web Services that are hosted on our public web server.
We are using JSON as our data interchange format.
So far we have been testing the application and everything is working fine but there is one big thing to solve: the .NET web services are public. If you go to the service URL: http://www.whatever.com/myservice.asmx you can assign values to the parameteres and invoke the service.
Obviously we don't want to have them publicly available and we want them to be secure.
I've been reading some questions here at stackoverflow but I haven't found a good answer.
I was thinking of adding a "password" parameter to every web service that I have and there sending a password to the server so that it can verify that it's the Blackberry trying to consume the service and not some spammer. That password would go as a String in each JSON request that the Blackberry does.
Another thing that is important to mention is that we have a simple web hosting solution from GoDaddy so our hosting is shared, we don't have full control on the computer.
Is this a correct approach?
For better protection depending on content importance you can use checksums or encryption methods.
You can use bouncycastle cryptography API http://www.bouncycastle.org/. This is free and good.
This can be used in both C# web service and blackberry application because it supports both C# and Java.