XMLHTTP Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bboyle18@gmail.com

    XMLHTTP Question

    Hi,

    I've been looking into the possibility of using XMLHTTP for my
    enterprise application but I still have a question.

    When you send the request to the server, how does the server know how
    to handle the request? (i.e. how do I specify what method to call in my
    java servlet?)

    I'd appreciate any help on this.....I've only got a vaey basic
    knowledge of javascript and I am fluent in java.

    Thanks,

    B

  • The Mighty Krell

    #2
    Re: XMLHTTP Question


    Treat it as you would any other URL.

    MK


    <bboyle18@gmail .com> wrote in message
    news:1109032286 .312504.169410@ c13g2000cwb.goo glegroups.com.. .[color=blue]
    > Hi,
    >
    > I've been looking into the possibility of using XMLHTTP for my
    > enterprise application but I still have a question.
    >
    > When you send the request to the server, how does the server know how
    > to handle the request? (i.e. how do I specify what method to call in my
    > java servlet?)
    >
    > I'd appreciate any help on this.....I've only got a vaey basic
    > knowledge of javascript and I am fluent in java.
    >
    > Thanks,
    >
    > B
    >[/color]


    Comment

    • Martin Honnen

      #3
      Re: XMLHTTP Question



      bboyle18@gmail. com wrote:

      [color=blue]
      > I've been looking into the possibility of using XMLHTTP for my
      > enterprise application but I still have a question.
      >
      > When you send the request to the server, how does the server know how
      > to handle the request? (i.e. how do I specify what method to call in my
      > java servlet?)[/color]

      The request is simply a HTTP request, for instance a GET request, a
      servlet then knows how to treat a HTTP GET request and the servlet
      container I think provides an API to read the query string. Similar if a
      HTTP POST request is send I think a servlet has a method to process such
      requests and read out the body of the POST request.
      So on the client you need to decide about the URL of the servlet, about
      the HTTP request method (e.g. GET, POST etc) and then make the request e.g.
      var httpRequest = new XMLHttpRequest( );
      httpRequest.ope n('GET', 'servletURL', true);
      // now set request header if needed
      httpRequest.onr eadystatechange = function () {
      // handle response here e.g.
      if (httpRequest.re adyState == 4) {
      ..
      }
      };
      httpRequest.sen d(null);
      or
      var httpRequest = new XMLHttpRequest( );
      httpRequest.ope n('POST', 'servletURL', true);
      // now set request header if needed
      httpRequest.set RequestHeader(' Content-Type',
      'application/x-www-form-urlencoded');
      httpRequest.onr eadystatechange = function () {
      // handle response here e.g.
      if (httpRequest.re adyState == 4) {
      ..
      }
      };
      httpRequest.sen d('a=1&b=2');

      A HTTP request doesn't call particular methods on the server, for that
      you would need to look into webservices, IE/Win with the webservice
      behavior and Mozilla with its webservice proxying API allow that but of
      course then you also need to implement a web service on the server.

      --

      Martin Honnen

      Comment

      • Mr.Clean

        #4
        Re: XMLHTTP Question

        <SNIP>[color=blue]
        > A HTTP request doesn't call particular methods on the server, for that
        > you would need to look into webservices, IE/Win with the webservice
        > behavior and Mozilla with its webservice proxying API allow that but of
        > course then you also need to implement a web service on the server.
        >
        >[/color]

        On the other hand, XMLHTTP CAN call specific "functions" , or verbs on
        the server. Take, for instance the WebDAV implementation of Hotmail, in
        the WebDAV specs, there are no mentions of BPROPPATCH, BDELETE, BMOVE,
        verbs, etc. However, you can call them using XMLHTTP on their WebDAV
        implementation.

        It really depends on how your server is written.

        Comment

        • Martin Honnen

          #5
          Re: XMLHTTP Question



          Mr.Clean wrote:

          [color=blue][color=green]
          >>A HTTP request doesn't call particular methods on the server, for that
          >>you would need to look into webservices, IE/Win with the webservice
          >>behavior and Mozilla with its webservice proxying API allow that but of
          >>course then you also need to implement a web service on the server.
          >>[/color]
          >
          > On the other hand, XMLHTTP CAN call specific "functions" , or verbs on
          > the server. Take, for instance the WebDAV implementation of Hotmail, in
          > the WebDAV specs, there are no mentions of BPROPPATCH, BDELETE, BMOVE,
          > verbs, etc. However, you can call them using XMLHTTP on their WebDAV
          > implementation.
          >[/color]

          Other protocols can certainly be implemented on top of HTTP or using
          HTTP as the transport, for instance a web service client and a web
          service server usually communicate by exchanging SOAP messages over HTTP
          and for instance the MS web service behavior is implemented with the
          help of Microsoft.XMLHT TP.

          But the original poster asked about XMLHTTP and servlet communication,
          that looks more like doing a certain HTTP request (e.g. GET, POST) on
          the client and processing that with the servlet as something that
          receives HTTP requests and sends a HTTP response.

          --

          Martin Honnen

          Comment

          • Mr.Clean

            #6
            Re: XMLHTTP Question

            In article <421b514f$0$249 46$9b4e6d93@new sread2.arcor-online.net>,
            mahotrash@yahoo .de says...[color=blue]
            >
            >
            > Mr.Clean wrote:
            >
            >[color=green][color=darkred]
            > >>A HTTP request doesn't call particular methods on the server, for that
            > >>you would need to look into webservices, IE/Win with the webservice
            > >>behavior and Mozilla with its webservice proxying API allow that but of
            > >>course then you also need to implement a web service on the server.
            > >>[/color]
            > >
            > > On the other hand, XMLHTTP CAN call specific "functions" , or verbs on
            > > the server. Take, for instance the WebDAV implementation of Hotmail, in
            > > the WebDAV specs, there are no mentions of BPROPPATCH, BDELETE, BMOVE,
            > > verbs, etc. However, you can call them using XMLHTTP on their WebDAV
            > > implementation.
            > >[/color]
            >
            > Other protocols can certainly be implemented on top of HTTP or using
            > HTTP as the transport, for instance a web service client and a web
            > service server usually communicate by exchanging SOAP messages over HTTP
            > and for instance the MS web service behavior is implemented with the
            > help of Microsoft.XMLHT TP.
            >
            > But the original poster asked about XMLHTTP and servlet communication,
            > that looks more like doing a certain HTTP request (e.g. GET, POST) on
            > the client and processing that with the servlet as something that
            > receives HTTP requests and sends a HTTP response.
            >
            >[/color]


            XMLRPC can be achieved using XMLHTTP and just POST and GET. That is how
            SOAP is implemented, correct?

            Comment

            Working...