473,320 Members | 1,821 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 20 '05 #1
0 912

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...
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 =...
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...
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...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.