M
mt404
Hi everyone, I have what I think is a simple question concerning
making an asynchronous web request using the BeginGetResponse /
EndGetResponse methods of httpWebRequest.
My app needs to fire off a bunch (possibly thousands) of http requests
at once. Each request calls a java servlet which places a telephone
call. I need to examine the stream returned and do a simple SQL
update to log the status of the call. Unfortunately the info returned
by the servlet is pretty minimal and doesn't include any information
other than success, busy, no_answer, etc..
What I need to be able to do is identify which call each status
message relates to. However, I can't quite figure out how to do this
=( Is the state object what I should be paying attention to here? Is
there a way to make the phone number available to the callback
delegate that is receiving the response stream?
For instance to initate the request:
----------
string URI = "http://xxx.xxxx.com/connect-Phone?phone_number=555-555-5555";
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(fullURI);
RequestState myRequestState = new RequestState(notificationId);
myRequestState.request = req;
IAsyncResult result = (IAsyncResult) req.BeginGetResponse(new
AsyncCallback(RespCallback),myRequestState);
------------
How can I get the 555-555-5555 as a variable to use in my SQL queries
held within RespCallback?
Many many thanks for any help anyone can offer!
making an asynchronous web request using the BeginGetResponse /
EndGetResponse methods of httpWebRequest.
My app needs to fire off a bunch (possibly thousands) of http requests
at once. Each request calls a java servlet which places a telephone
call. I need to examine the stream returned and do a simple SQL
update to log the status of the call. Unfortunately the info returned
by the servlet is pretty minimal and doesn't include any information
other than success, busy, no_answer, etc..
What I need to be able to do is identify which call each status
message relates to. However, I can't quite figure out how to do this
=( Is the state object what I should be paying attention to here? Is
there a way to make the phone number available to the callback
delegate that is receiving the response stream?
For instance to initate the request:
----------
string URI = "http://xxx.xxxx.com/connect-Phone?phone_number=555-555-5555";
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(fullURI);
RequestState myRequestState = new RequestState(notificationId);
myRequestState.request = req;
IAsyncResult result = (IAsyncResult) req.BeginGetResponse(new
AsyncCallback(RespCallback),myRequestState);
------------
How can I get the 555-555-5555 as a variable to use in my SQL queries
held within RespCallback?
Many many thanks for any help anyone can offer!