Results 1 to 4 of 4
  1. #1
    omikeneil is offline Member
    Join Date
    Oct 2009
    Location
    NJ, USA
    Posts
    3
    Rep Power
    0

    Default How to Call a java service

    I am working to build a home automation web application. I have multiple automation devices with RS232 interfaces. I have successfully interfaced with these devices using demo code. Now I would like to create a Java service/Daemon that read/writes to the COM ports and maintains the state of the devices for a tomcat web application to interact with.

    2 things I am looking for are what is the best way to create this Daemon and how do I call the daemon from my web app?

    I think my terminology is not accurate as I do not find much material when I search the web for "howto call Java service"

    I am relatively new to java and familier with the basics of java, OO, etc.
    Platform for development is eclipse on Windows. Server is Debian Linux.
    Links to how to, proper terms and sample code would be appreciated.
    I am more of a hacker than a student - try it don't study it.
    Thanks,
    Mike

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default Xml rpc

    How about a kind of XML-RPC, as Redstone XML-RPC Library

    In the past I have even built my own custom integration using the unix fifo, that is only useful for simple line oriented kinds of messages, and is one way..

    an XML RPC over a plain TCP socket is the most flexible. You build the 'server' side into the java service and have it open up a socket on the local host. then your web application, in a servlet handler you implement the XML RPC 'client' that connects to the local port.

    If the connection is not intended to be accessed by other machines, you can bind the socket on the loopback address only, but with some more security or authentication mechanisms it is convenient to allow the service even to run on a different machine as the webapp if that is ever needed.

  3. #3
    omikeneil is offline Member
    Join Date
    Oct 2009
    Location
    NJ, USA
    Posts
    3
    Rep Power
    0

    Default

    Thanks travishein,
    after posting this I found articles on creating a program and opening a socket as you mention, to be the service. That seems to be the best method for quick POC to which can be built more advanced functionalitiy.

    I really like your suggestion of using XML, I think that will allow me to standardize the server side making the client platform more independent.

    Right now the server I have to playwith is a mothballed old desktop with very little memory. Though in it's day I was quite proud to say that was my PC. Maybe I will win the Tiger direct PC a day giveaway to upgrade the computing environments . . .

  4. #4
    omikeneil is offline Member
    Join Date
    Oct 2009
    Location
    NJ, USA
    Posts
    3
    Rep Power
    0

    Default

    by the way, the Sun doc on creating the server socket layer and the client layer was found here:
    java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html

Similar Threads

  1. how to call service method inside another service
    By kirtichopra2003 in forum Web Frameworks
    Replies: 1
    Last Post: 10-24-2009, 02:19 AM
  2. Consume a .net web service with a java client
    By pauldj54 in forum New To Java
    Replies: 3
    Last Post: 07-15-2009, 11:53 AM
  3. Consuming a Web Service using Java
    By gopikrishnatb in forum Web Frameworks
    Replies: 2
    Last Post: 03-02-2009, 09:59 AM
  4. Java Message Service
    By Java Tutorial in forum Java Tutorial
    Replies: 0
    Last Post: 06-09-2008, 09:57 PM
  5. Java Service Wrapper 3.3.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 03-29-2008, 01:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •