Starting point for Java client/server remote application - java

I have an existing java project that I wish to create a mobile 'remote control' application that is capable of calling a few public methods from the existing project.
I have no previous experience of any sort of networking development so would appreciate some guidance on where I should start. I've found a few libraries out there but I'm not entirely sure what I'm looking for (or if I'm overcomplicating things!).
Thanks,
Adam

Java RMI technology may be what you need, here's where to start http://docs.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html. It can be used when both client and server are in Java.

If you want to use webservices you could take a look at this Exposing existing API as a Web service
You could check this out Java client/server application with sockets? in order to learn from previous discutions on the client/server subject.

Perhaps lean towards JAX-RS unless you want to deal with low level or have any constraints on protocol to use. http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html.

Related

Remote Procedure Call Mechanisms between Android and Desktop Computers

I want to perform Remote Procedure Calls between Android and Desktop.
If RMI was there,it would have been mine choice.
But android does not support Java-RMI.
Can anybody suggest similar and simple RPC mechanisms that i can use as easily as RMI,without worrying about lower layer transport layer implementations
Kindly give me the alternative for RMI in android
I think you may be able to use different strategies:
- Web Services calls using SOAP, XML RPC, using Rest invokations types.....many strategies
- alternatives to Web Services available like the one provided in Spring Remoting with Burlap/Hessian protocols (you are not obliged to be tied with Spring to use such strategies)
Main idea is to use as core component a protocol managed by your android device : HTTP...
HTH
Jerome
Another option is Versile Java (full disclosure: I am one of the developers). It is in development but already quite stable, so you may want to have a look. Here is a demo which shows an Android client using Versile Platform to interact with a python based service running on a desktop.
RPC is generally a lousy technique, especially for remote operation. And it's not supported in most UI environments because you're never supposed to "wait". Far better to use some sort of a request/response approach.

Java and .NET application interoperability

I am having a Java application and a .NET application both residing in two different machines and need to design a communication layer between these two applications. Any inputs or ideas would be really helpful. Below mentioned is the nature of interaction between these two applications.
Java applications sends large amounts of data to the .NET application
Data latency should be kept to a minimum
.NET application should also be able to request for some data (synchronously/asynchronously)
The easyest way .Net and Java can talk is using Web-Services - we have done in my company with much success (using apache's cxf and standard code on the .Net side).
But if latency and size are the main requirements, you should use Sockets - both platforms offer a pretty extensive socketing frameworks and it would give you the best performance possible.
I think this can be done by setting up an xml webservices layer on the java side. You can use RestEasy for restful web services. Just my .2 cents.
Another alternative is some form of MOM (Message Oriented Middleware). There are a lot of implementations, but one to look at first might be ActiveMQ as it has both Java and C# bindings (among others).
I'm not saying this is better than using a web-service, it entirely depends on what your requirements are.
We have had good experiences with providing web services with JAX-WS (part of standard runtime in Java 6). They explicitly list .NET compatibility as a goal and is well supported in IDE's.
The Endpoint.publish() mechanism allow for small, simple deployments.
You can use Web Services. Jax-WS is the API in java that allow you to use it. As the implementation of this API I recommend metro (http://metro.java.net/), this already came with the SDK, and has a great integration with netbeans.
As already someone referred yet, you can use a socket, and create a communication channel on that, but this have some problems, starting with security. Don´t use this in real life applications.
If you need help with this subject you can start reading this:
Getting started with JAX-WS
It really depends on your requirements. The simple way is generally Web services. However, if you want higher performance, or more fine-grained access to the API on the other platform, you might want to consider JNBridgePro (www.jnbridge.com).
Disclosure: I work for JNBridge.

Creating web service app for enterprise Java vs C++?

So we want to develop a service app (web Service with post/get API). What is language to go for secure, fast, enterprise app for about 2000 employers to use with about 20~40 services for interacting with DB server (which in my case will be Oracle) Dev time a year Dev team of 3. All capable of righting C++ code as well as Java (so they will now them equally bad at the beginning of process)
Definitely java! You might want to check the jee6 tutorial on JAX-WS to get an idea of how web services are created using enterprise java (http://download.oracle.com/javaee/6/tutorial/doc/bnayn.html)
This will also guide you on how to do it using the netbeans IDE (http://netbeans.org/kb/docs/websvc/jax-ws.html)
Cheers!
You'd be masochistic to try this with C++! Definitely Java, J2EE whatever (look at various technologies from groups such as JBoss). The development process will be significantly faster using these existing technologies than writing your own...
The question is not what language to choose but which "architecture" or paradigm.
If you want/need to use SOAP then C++ might be fine, go and google for "gsoap". However I would recomend Java and REST as architecture paradigm, well we would need to know more what you really want to do. Perhaps some RMI or CORBA would be much easier. If you want to play with Java, Groovy or Scala (all languages run on the Java JVM), then google for "restlet".
Best Regards
Angelo
I would suggest using the Java / Netbeans combination.
Netbeans has a number of tools which makes web service development easy.
Good overview here.
Netbeans allows full use of JAX WS and Metro and is integrated with Glassfish and Tomcat servers (part of Netbeans download) so you can get up to speed really quickly.
you can use either C++ or Java depending what you're implementing. To see an example on C++ check out this great post by IBM Engineers: http://www.ibm.com/developerworks/webservices/library/ws-xml-rpc/

How to make my Java Swing application a Client-Server application?

I have made a Java Swing application. Now I would like to make it a Client-Server application. All clients should be notified when data on the server is changed, so I'm not looking for a Web Service. The Client-Server application will be run on a single LAN, it's a business application. The Server will contain a database, JavaDB.
What technology and library is easiest to start with? Should I implement it from scratch using Sockets, or should I use Java RMI, or maybe JMS? Or are there other alternatives that are easier to start with?
And is there any server library that I should use? Is Jetty an alternative?
Given that you have the application already, perhaps the simplest thing to do is to identify the interface that you require between the client and server, and first of all to refactor your application to use that interface to talk between the back-end/front-end within the same process.
Then you can start to split this apart. A simple solution would be to split this apart using RMI (since you're talking Java objects and have Java method calls). Spring contains useful tools to simplify/automate the RMI exposure of interfaces.
For the notification requirement, a simple UDP multicast (or broadcast) would suffice.
Note that as soon as you split your application up, you have issues re. maintaining consistent views of data, managing timely updates, handling cases when the server is down, possible loading issues when you get lots of clients etc. In a sense, splitting the application up into a client and server is just the start of a new architecture process.
Mina is a good choice as a network application framework for building a simple server for this purpose - it's a much better option than using raw sockets.
http://mina.apache.org/
If you really need an application server then you could take look at JBoss. It also provides a remoting component (as an alternative to something like Mina):
http://www.jboss.org/jbossremoting
You probably won't have much need for Enterprise Java Beans though. In most cases a simple POJO based framework is more than sufficient - you could tie this altogether with a dependency injection framework such as Guice:
http://code.google.com/p/google-guice/
or Spring. Keep it simple, don't use a J2EE server unless you really need to. Hope that helps.
This is much of what J2EE does, but it's a whole new learning curve because they have pre-solved many of the problems you will run into and many you may not and therefore add on a lot of new technologies.
But at it's most basic, J2EE answers just that question.
I worked in a project like this. We implemented Client-Side Swing and Server side with J2EE. We used EJB,Stateless beans and Message Driven Beans.Also I have been in a device tracking, management project. Our clients were trucks+Swing users and We have used Servets+TCP/UDP,Apache Mina framework to handle and keep connections.
I have been working in Java Swing Client/Server applications for almost 3 years. I would suggest you to go for RMI/EJBs. The initial application that we developed was doing this using RMI/EJB for client-server communication with WebLogic being the server.
But we later found out that there are lot of "browser-like" features to be included to the application such as session-timeout etc., So, we used the BrightSide Framework which wraps the RMI calls through HTTP. One more enhancment we made is that we replaced Weblogic with the open source JBoss server.
The wrapping of calls with HTTP will become very handy and you can make your swing applications really rich. Later, when the situation demands for you to use a website strictly, you can deploy your swing using jnlp.
Hope this helped.

Getting java and flash to talk to each other

I have an application written in java, and I want to add a flash front end to it. The flash front end will run on the same computer as the java app in the stand alone flash player. I need two way communication between the two parts, and have no idea how to even start going about this. I suppose I could open a socket between the two programs, but I feel that there must be an easier way. Is there a nice part of the api in actionscript 3.0 that will allow me to access java methods directly, or will I have to resort to sockets? I am relatively new to flash, by the way, so any good guides would be much appreciated!
Thanks
AMF is a messaging protocol commonly used to talk between flash and a backend system. There're several Java implementations, but I haven't used any of them so can't tell you which is best.
Blaze DS
Red5
Granite DS
Flash can also talk plain old XML, SOAP or REST to the backend, so depending on your codebase that might be easier.
There is also OpenAMF. It is very mature, stable, simple and lightweight relative to Blaze, Red5 and Granite.
BUT, it is also dated (AMF0 protocol only) and the project is no longer active. Lots of people are still using it out in the wild. And the documentation is borderline non-existent.
Granite DS is a good solution, it will allow you to set up services to communicate not only to POJO's but to EJB3 session beans also. It comes with a GAS code generator for converting your java beans into as3 equivalents and also data push to the client using the gravity side project.
MERAPI is a bridge framework for communication between Java and Flash.
I agree on Granite DS. It was easy to setup and get going.
I have used it to talk directly with a EJB3 bean communicating with thrift generated objects.

Categories