This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have MyClass that will be on TomCat.
I have a "procedure" that will be run on BEA(maybe others). This service queries DB that returns a java object.
I plan to call a servlet on BEA that returns this object.
So, MyClass in TomCat sends request to BEA servlet using java.net classes. Response from BEA sends back java object.
Seems ok? I want to avoid VPN to BEA. Should I be looking at different solution? How do I return java object? I have so far only returned text and such.
I would prefer something simple.
RMI can work over HTTP (HTTP Tunneling). See:
Frequently Asked Questions: JavaTM RMI and Object Serialization C.10How can I make outgoing Java RMI calls through a local firewall? rmiservlethandler.zip However:
The major disadvantage of HTTP tunneling is that it does not permit inward calls or multiplexed connections. A secondary disadvantage is that the http-to-cgi method opens a dramatic security hole on the server side, since without modification it will redirect any incoming request to any port.
"application/xml" carries the data within an XML document - this approach is often referred to as "POX over HTTP" (POX: plain old XML). You can simply use XML Schema to define the documents to carry your query and result set data and then use something like JAXB (Object Serialization with the JAXB Libraries†) to do the XML-to-Java (unmarshal) and Java-to-XML (marshal) translation work for you. SOAP web services take this approach to the extreme as they carry the XML document as the "payload" in their "body" while they use SOAP headers for all sorts of enterprisy extensions.
† This tip is based on JAXB 1.0 that was part of the Java Developer Web Services Pack - however the approach is valid for JAXB 2.0 which is part of Java 6 (or can be used with Java 5) and the sample code contains a JAXBServlet.java which could be used as a starting point