I have to write a program that will run on an IBM iSeries and communicate with a Matrics RFID reader. The reader documentation says I "must supply a host IP address and port where the host system can be contacted (via GET/POST)" I am new to Java (almost done with the Java Ranch course) and would like to try to write this in Java. The iSeries host will have IBM HTTP Server (Apache) and Tomcat. My assumption is that I can do this with a servlet. Can anyone tell me if that is correct and possibly give me some direction. Thank you.
I am unsure of the interface(s) provided by Matrics Reader.
Your description suggests that matrics reader provides a HTTP interface.
In such scenario. Web Server (tomcat) will run on the iSeries host at a designated port.
Get HTTP connection to your Web Server from Matrics Reader (client). (using host and port)
Invoke a servlet that is hosted by the Web server for getting a desired response.
The servlet will process your actual solution to the request.
Thanks, Sreedhar Napa
Joined: Jun 04, 2004
Yes it is an HTTP interface. I haven't seen the RFID reader configuration yet but was told that all we can give it is the host IP address and port. Does this mean that we would have a separate instance of Tomcat running on an unused port exclusively for the RFID reader communications and configure Tomcat to default to my servlet whenever anything comes in on that port?
As you can surmise I am new to Web Servers also. Thanks again for your help.
It sounds like the device has its own builtin web server and you're expected to query that from some application. Either that, or the device has a builtin web client.
If the device is a web server and the IP address you supply is its server IP, you could try peeking inside it with your favorite web browser to see what it expects. Then create whatever application you want to use HttpURLRequests to poll it. That can be done from a standalone app. It's not really a web server's forte, though web servers can be set up with internal threads for such things.
OTOH, if the device is a web CLIENT, then you really need to know what the types of requests coming from it are. And then, what it wants you to respond with.
Whether you do all this in Java, ASP, PHP or whatever is actually immaterial, since the main constraints are in the standards you're required to work with.
An IDE is no substitute for an Intelligent Developer.
Joined: Jun 04, 2004
The reader documentation says there are two approaches for getting information from the reader. The Query approach which provides a snapshot of the current visibility of tagged items and the Publish/Subscribe model which allows you to subscribe for the type of event notifications you want to receive. I have tested the query approach with a java program that uses URL, BufferedReader and FileWriter and was able to retrieve the XML data. With the publish/subscribe approach the reader will initiate the communication by sending something like "http://192.168.0.127/?oper=test" which I must acknowledge after which it will send "http://192.168.0.127/?oper=notify". At this point I should be able to use the query to retrieve the events that we have configured the reader to notify us for. I am having trouble understanding what I should have running on the host (iSeries) to accept that first communication from the reader. Thanks for your response.
Joined: Jan 29, 2002
There are host of technologies to solve your problem. As the question belongs to JAVA community here are the technolgies which probably may be of use. 1. Java web services. (XML based communication) 2. Servlets. 3. Networking techniques. I believe the best technology for you is JAVA web services.
Using servlets you have to keep in mind that it is not one servlet running on a designated port. It is the web container .. (container may consists of lot of servlets)..
One servlet can be treated as a service (If using web service techniques it should be more easier)
With the publish/subscribe approach the reader will initiate the communication by sending something like "http://192.168.0.127/?oper=test"
The reader will initiate communication So http://192.168.0.127/ will point to your tomcat instance (don't forget the port) --- ?oper=test.. You have to configure this to a designated servlet or a web service
oper => operation
To a particular operation now we are able to call a designated web service or a servlet
Now the question is how the reader will pick up the response that is generated out of the servlet or web service.
I think you should find the answer to this yourself.