473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem in invoking WebMethod at client side

Hi:

I had the following client proxy code autogenerated:

Code I:
[System.Web.Services.Protocols.SoapRpcMethodAttribu te("http://tempuri.org/ProcessCondensateFile", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/")]
public bool ProcessCondensateFile(CondensateFileContainer condensateFileContainer) {
object[] results = this.Invoke("ProcessCondensateFile", new object[] {
condensateFileContainer});
return ((bool)(results[0]));
}
While debugging, I would loose control at this.Invoke(). i.e. The app never reached the return statement nor did it time-out (the default is 100). Not sure of what is happening, I overrode GetWebRequest() method of the client proxy to do the following:

Code II:
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = null;
try
{
webRequest = (HttpWebRequest) DoWorkHandler(uri);
}
catch (Exception e)
{
string msg = e.Message;
}
return webRequest;
}
private WebRequest DoWorkHandler(Uri uri)
{
return base.GetWebRequest(uri);
}
Sure enough, I lost control in DoWorkHandler at the return statement. Armed with this information, I tried to call the DoWorkHandler asynchronously like below with my own timeout since the timeout of the webservice client proxy never worked at the first place:

Code III:
protected override WebRequest GetWebRequest(Uri uri)

{
HttpWebRequest webRequest = null;
try
{
WorkDelegate d = new WorkDelegate(DoWorkHandler);
IAsyncResult res = d.BeginInvoke(uri,null,null);
if(res.IsCompleted == false)
{
res.AsyncWaitHandle.WaitOne(10000,false);
if(res.IsCompleted == false)
throw new ApplicationException("Timeout");
}
webRequest = (HttpWebRequest) d.EndInvoke((AsyncResult)res);
}
catch (Exception e)
{
string msg = e.Message;
}
return webRequest;
}
Surprisingly this works. i.e. The request is passed to the service and I am getting a response back (no timeouts either). I would rather like to have Code I as opposed to Code III. Can somebody enlighten me as to why is this happening? I am working on a Windows XP workstation with Visual Studio 2003. My client and service are on the same box. I've at least 20 other services / clients running under same box using the same kind of interface without any hiccup.

Thanks,

Ram

Nov 18 '05 #1
0 1287

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

Similar topics

7
by: Ram P. Dash | last post by:
Now this is a classic. The impersonation fails for CASE I but doesn't fail for CASE II or III. Case I: Client Side Code ----------------- System.Net.NetworkCredential credential = new...
24
by: Joseph Geretz | last post by:
Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure...
3
by: Ipsita | last post by:
Hi! I am trying SOAP with DIME attachments in web services. For example say, I have a file resume.pdf stored somewhere on my server. How does the web service send the file to the client, so that...
0
by: Ram P. Dash | last post by:
Hi: I had the following client proxy code autogenerated: Code I: public bool ProcessCondensateFile(CondensateFileContainer condensateFileContainer) { object results =...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
1
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
4
by: Jay | last post by:
2.0 asp.net app (precomiled in 2005, not updateable, dll's in bin and then merged to one dll)... web app calls a 1.1 (compiled in 2003) webservice initialization webmethod (works). Second call...
3
by: Khurram | last post by:
Hi, Firstly, I will apologise now if I have posted in the wrong discussion group. Please let me know if I have for future reference. Below is the code to a WebMethod that is querying an Access...
2
by: Marek Suski | last post by:
Hi all, I am getting following error while a user is trying to execute web method from proxy class (proxy class inhertis from WebServicesClientProtocol class) System.Xml.XmlException: There is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.