473,509 Members | 10,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 23 '05 #1
5 1554

Treat it as you would any other URL.

MK
<bb******@gmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
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

Jul 23 '05 #2


bb******@gmail.com wrote:

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?)


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.open('GET', 'servletURL', true);
// now set request header if needed
httpRequest.onreadystatechange = function () {
// handle response here e.g.
if (httpRequest.readyState == 4) {
..
}
};
httpRequest.send(null);
or
var httpRequest = new XMLHttpRequest();
httpRequest.open('POST', 'servletURL', true);
// now set request header if needed
httpRequest.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
httpRequest.onreadystatechange = function () {
// handle response here e.g.
if (httpRequest.readyState == 4) {
..
}
};
httpRequest.send('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
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
<SNIP>
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.


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.
Jul 23 '05 #4


Mr.Clean wrote:

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.


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.


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.XMLHTTP.

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
http://JavaScript.FAQTs.com/
Jul 23 '05 #5
In article <42***********************@newsread2.arcor-online.net>,
ma*******@yahoo.de says...


Mr.Clean wrote:

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.


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.


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.XMLHTTP.

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.

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

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1743
by: WhenAmIOn.com | last post by:
Hi all, I developed a web site that uses javascript and XMLHTTP to dynamically load info on the page from the server without having to re-load the page. Recently I've received complaints of it...
4
3043
by: parksch2 | last post by:
When I execute the following example code from my local test environment: var xmlhttp.open("HEAD", "http://www.google.com",true); xmlhttp.onreadystatechange=function() { if...
6
10441
by: Vanessa | last post by:
I have a question regarding async mode for calling Microsoft.XMLHTTP object. Microsoft.XMLHTTP hangs the IE once in a while suddenly, but it will work again after half an hour or so without doing...
1
1318
by: Dave H | last post by:
First.. What object (on the client) should I be using these days? var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); or var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); or maybe...
3
9540
by: Noozer | last post by:
Hrm.. last posting was mangled. Let's try again, with more detail... I'm just starting to try out "Ajax" web programming and I've got a question. AJAX is fairly straightforward. Javascript...
1
3084
by: mirandacascade | last post by:
I recognize that this question is not about javascript per se...it is more about xmlhttp...posting the question at this site because it appears as though this site has many posts related to xmlhttp...
14
14117
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
I've been searching everywhere online to find an alternative method besides using Microsoft.XMLHTTP (as it freezes the server up alot!!) but with no luck at all. I am using server side ASP, and...
2
12447
by: trpost | last post by:
Is it possible to execute javascript as passed in xmlHttp.responseText Here is what I am doing: search.js var xmlHttp xmlHttp=GetXmlHttpObject() var url="search.php"...
2
1904
mothermugger
by: mothermugger | last post by:
I saw some posts about this problem in the archives. But I can't gleam what the solution is... This works fine except • <== here is the problem the dot becomes 2 question marks (try the code)...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.