0

I have multiple Java web applications deployed on the same server (Wildfly).

They all should use a single WebSocket implementation to send messages (object, not plain text) to the user.

Edit: WebApp1-3 are the applications with the business logic. The only purpose of WebApp4 is to update a Primefaces panel in the browser based on the messages generated by the other WebApps. Sorry for the missleading illustration.

WebApp1
WebApp2    -->    ???    -->   WebApp4 (WebSocket-Server)   -->    JS/Browser
WebApp3

Which is the best way/pattern/implementation to make WebApp4 available to the other applications? (RMI, JMS, WebSocket, WebService, ....?)

sinclair
  • 2,812
  • 4
  • 24
  • 53

2 Answers2

0

My advice, for a general way of exposing services, is to expose REST services since they are simpler than SOAP web service and easily allow interoperability (if in the future a PHP or a RUBY webapp needs to consume your services it's much easier with a REST interface than with one base on RMI or JMS). The content of the REST service may vary, I suggest you to look at XML or JSON as a way of transmitting information over http REST services.

Giovanni
  • 3,951
  • 2
  • 24
  • 30
0

If all webapps are in the same server, you should forward requests from one to another. From the point of view of webapps 1-3, they would not need to be aware of whether their incoming requests were coming from webapp 4 or from outside (to which it appears that they are not connected). Of course, you are free to alter requests before forwarding them - or to drop them altogether, for example if authentication fails.

To do this in tomcat: https://stackoverflow.com/a/8951090/15472

When forwarding requests, the external client is completely unaware of the existence of webapps 1-3 -- as far as the client is concerned, it has sent a request to webapp 4, and it will think it is receiving a response from that same server.

You may need to configure your web server to allow these kinds of calls, but I am unfamiliar with WildFly.

Community
  • 1
  • 1
tucuxi
  • 17,561
  • 2
  • 43
  • 74