Announcement Announcement Module
No announcement yet.
Separate Web Client needed? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Separate Web Client needed?

    Dear all,

    My "demo" Web Service written based on clinic.roo is running fine on my local Tomcat. As far as I am concerned, I can use any Browser as a client to access and consume its Services simply by specify a URL to it e.g. http://localhost/demo brings up the Home page.

    Now, "demo" is running on a Tomcat in the network. I expect any browser opened up within this network can act as a Web Client to the "demo" Web Service simply by specifying a URL to it e.g. "http://192.168.xx.xx/demo" or "http://192.168.xx.xx:8080/demo" to bring up the Home page. Am I wrong?
    Do I need to write a RESTFUL Web client using RestTemplate or any good old web client in order to access and consume "demo"'s Web Services? Under what circumstance do I need a separate RESTFUL web client written up as a consumer? In a Remote access situation?

    As far as I am concerned, clinic.roo is a Web Service with Web client built in. If I send an HTTPRequest from a client machine to "clinic" running in a network Tomcat, the HTTPResponse will be received by the client machine. The business logic to process this HTTPResponse message can be written inside this Web Service "demo" module as well. Am I wrong?

    Please straighten me out. I need your advice.

    Many Thanks.

  • #2
    Depending upon your firewall permission and your network settings (you can also have 10.x.x.x for LAN ips) you should be able to access the application

    You have to setup the port 80 version (ie the one where you dont specify port for http: as an extra, you would need to look documentation for mod_jk or mod_proxy (I prefer the first)

    I am not sure what is your motivation of defining the web application as web services and builtin client. It is a web app, which transfers the presentation layer as well as the state, the client is still the browser.

    You still talk HTTP/HTML so it is a webapp in my books (and not a web service)

    If you want to make a client which works on HTTP but sends in different kind of Data (JSON, XML) and interacts with the services in resful way then that would be a seprate Restful client.


    • #3
      RE:RE:Separate Web Client needed?

      Thank you so much for your reply.

      "demo" is a Web Service running in a Server (Tomcat, JBOSS) so anyone with a browser can access it via the Internet to fiddle with a back-end MySQL database.

      By Web Application, did you mean that it starts at main()? Will that work the same as what I described above?

      My clients are actually wireless devices and they send HTTP Requests to "demo" and "demo" sends forms/web pages to the browser client for input and then return a HTTP Response to them; both Request and response are in XML format.

      I am using XStream for my XML conversion and it seems to work fine so far on the server side. Of course currently, I am running Server-side logic and Client-side logic together when running from the same machine, like a loopback.

      The idea is for the Web Service to receive any HTTP Requests coming in and sends a HTTP Response back to the URL of the sender.

      In this scenario, do I need a separate web client (web application) in order to consume the "demo" Web Service running on my Tomcat?

      Am I using the right approach?

      (Given that my Server has opened up port 80 allowing HTTP Requests to come in and Responses to go out....)

      Your help is and will be greatly appreciated.


      • #4
        RE:RE:RE:Separate Web Client needed?

        If I may clarify further:

        I have wired clients and wireless clients. For wireless clients, the only communication between Server and client is via HTTP messaging, message body is in XML format.

        The wireless client (iPhone, Blackberry, Android...) can do whatever they want with the returned data.

        My wired clients (also for testing purposes) are Web Browser users. They URL into the Server and see the Home Page. they clicked something and a customized HTTP Request Form shows up for them to enter data. This HTTP Request Form is the View ('V' of the MVC) that the Server presents.

        User done entering data and click a SEND button. The Server than use the Form data to compose a HTTP Response in XML format to be sent back to the sender URL. For testing in wired connections via the Internet, the Server side returns a View of a customized HTTP Response message Form to display what data has been sent.

        My Web Service is acting both as a Server and a Client because it is capable of receiving HTTP Request and sending HTTP Response back. Only for testing, the HTTP Response will be displayed on a web page to show the user what has been sent. This is also a View (i.e. the HTTP Response View) that the Server puts out under the MVC model.

        For wireless endpoints, they send HTTP Request to Server and get back HTTP Response, that's it. The Server currently do the following:
        public class HttpRequestController {		
        	@RequestMapping(value = "/httprequest", method=RequestMethod.POST)
        	public @ResponseBody String createResponse(@Valid HttpRequest, httpRequest) {
                return httpRequest.createResponse(httpReqMsg1);	    
        // Http Response Java POPO
        public class HttpResponse {
                pubic String createResponse(httpRequest) {
                return this.toString;
        Now, the Server returns a long string to be displayed on the screen. I will change it to return a HttpResponse View with data. That way, any browser accessing my Server will see Forms to enter data and Forms to see what they had sent.

        Ultimately, the Service will have to distinguish between wired and wireless HTTP requests. For wireless request, under the MVC model, instead of returning a View (*.jspx) to the DefaultHandler() and display this View on the client browser, I think I will have to return NULL to get MVC to send back just a HTTP Response message to the sender URL (the wireless device).

        There are a few things that I simply don't know how to go about doing it yet (using the MVC model). For now, I want to get the wired web client working (i.e. to consume my Web services, put the composed Response message onto a Form to be shown on the Requestor's browser.

        In this scenario, do I need a separate Web Client?

        Thank you so much for reading thru my problem.

        Any help will be tremendously appreciate.