I have the following requirement:
I need to create a socket server that listens fro incoming requests. The socket clients are written in C. The clients send JSON data.
The client input needs to be redirected to different sources. for example there might be a need to call an internal or external web service(SOAP开发者_开发知识库, JAX-WS).
My question is, what is the best way to achieve such a communication?
I would implement the redirecting service as an observer and notify him when your observable (the socket server that listens) is called. If you're not familiar with that pattern, have a look at http://en.wikipedia.org/wiki/Observer_pattern. You basically keep up the information flow by pushing your information further down the chain of processes instead of pulling it actively by your redirecting service.
I hope you didn't need any help with the SOAP, JAX-WS stuff - your requirement doesn't change anything compared to the way you would normally implement such a service. (If you're as lazy as me, go with the wsimport commandline application ^^)
精彩评论