473,834 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WCF wrapping proxy calls to catch errors

Hello,

I need to be able to somehow wrap calls made through a standard Interface
used to access a WCF service. The reason for this is to have a higher degree
of control, mainly to catch all kinds of exceptions transperently, and maybe
translate them to other exception types.

I've tried to wrap the interface with a class but that way I can only invoke
methods of the interface passing a string to an execute method
(wrapper.Execut e("MyMethod") ) instead of directly (wrapper.MyMeth od()).
Any way of wrapping proxy calls transparentrly? Any ideas on how to do this?

Many Thanks.
Dec 4 '07 #1
2 2690
=?Utf-8?B?S2lrZQ==?= <Ki**@discussio ns.microsoft.co mwrote in
news:98******** *************** ***********@mic rosoft.com:
Hello,

I need to be able to somehow wrap calls made through a standard
Interface used to access a WCF service. The reason for this is to have
a higher degree of control, mainly to catch all kinds of exceptions
transperently, and maybe translate them to other exception types.

I've tried to wrap the interface with a class but that way I can only
invoke methods of the interface passing a string to an execute method
(wrapper.Execut e("MyMethod") ) instead of directly
(wrapper.MyMeth od()).

You can have 2 interfaces, one to implement and one for your service
contract.

The service contract will contain your standard method calls (i.e.
GetUsers, DeleteUser, etc.). The other contract will look something
like:
OnGetUsers.

Then in your service you would call:

Private SomeObject as IMyInternal = New MyInternalImple mentation()

Public Function GetUsers as Users()
Try
IMyInternal.OnG etUsers
Catch Ex as Exception

End Try

Or maybe you can hook into ThreadException and globally catch errors?

--
sp**********@ro gers.com (Do not e-mail)
Dec 5 '07 #2
If your main objective is to catch errors, and manage the generated fault
exception, then use an IErrorHandler, an implementation of this interface
will be the last bastion before the exception reaches WCF core.

Note: The Microsoft Enterprise Library uses this interface

See more here:
http://msdn2.microsoft.com/en-us/lib...orhandler.aspx

Tiago Halm
Dec 5 '07 #3

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

Similar topics

1
6739
by: Chris | last post by:
Hello, I have a program that uses the CInternetSession and CHttpConnection mfc classes to register the program...it works for the majority of our customers, but a few have received errors, all of whom are going through proxy servers. Specifically, we have encountered a 400 error, a 500 error, and a 12152 error. On the 500, we have noticed that part of the url is appended to the sendstring twice, but have no idea why. Is there anyone out...
2
7580
by: Jacob Cohen | last post by:
Under VC7.1, I am trying to wrap a native-C++ DLL that contains C++ objects in a Managed-C++ class library for use in a C# project. I created and compiled the native DLL under VC7.1 as a Win32 DLL C++ (unmanaged) project. I found the decorated names of the symbols I wanted to export and created a .def file, so that it generated an import library. I took this import library and had my Managed-C++ class library link against it. The...
4
30082
by: Morten Snedker | last post by:
I'm trying to download a file. I've tried both using webclient and the httpWebRequest. Either way it returns a "407 proxy authentication required". The program is to be run externally, so basically I don't know the users login-name, password or domain. So that makes setting the proxy in code irrelevant, doesn't it? When searching the web it appears to be a common problem. But I haven't found my solution and still can't get it to...
1
4354
by: JohnH | last post by:
Hi, In my application which has two or more threads calling web service or just HttpWebRequest I am seeing some HTTP 400 errors retrun in the response. All the calls are going through the same ISA proxy the connections to which must be authenticated. The 400 error are comming fron the wed server back through the proxy. When I Sniff the connections I can see that the http message that is causing the issue is one that is part of the...
2
3493
by: =?Utf-8?B?TGFycnlLdXBlcm1hbg==?= | last post by:
Our WebDev team seems to have found a problem that exposes a bug in .NET 2.0. This problem can be shown when trying to access a WebService using SSL and through a proxy server after using the HttpWebRequest object. Under normal circumstances I am able to use the webservice without any problems. But after using an HttpWebRequest object to make a call to a website all subsequent attempts to use the WebService will fail with a 401...
2
2539
by: Gabriel Genellina | last post by:
En Tue, 29 Jul 2008 13:13:51 -0300, Magnus Schuster <magnusschuster@yahoo.comescribi�: __magic__ methods on new style classes are searched in the class, *not* in the instance. prx_i+1 looks for __add__ in type(prx_i), that is, in the proxy class. Try implementing a similar __getattr__ method in a metaclass. -- Gabriel Genellina
2
3690
by: Jerry Spence1 | last post by:
In VB2005 (.NET 2.0) when I do: my.computer.network.uploadfile I get the error "The requested FTP command is not supported when using an HTTP Proxy" Is there any way round this? Does this command work in .NET 3.0? -Jerry
5
5475
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm researching what is the best way to create a generic WCF proxy wrapper that has the following requirements: 1. Remove the System.ServiceModel config section requirement for clients. We have our own configuration management that follows our application lifecycle (development/system test/production). Also, most of the proxies we build are for the middle-tier layer. 2. Create a wrapper to follow WCF Client best practices (proxy.close...
0
2861
by: malkin | last post by:
Hi all, I have an external application that calls WebClient to download a file from our server. It runs fine without any proxy server involved. However, once there is a proxy server layer, it throws a 407 proxy authentication required error. My question is that since I do not know whether the users are going to download a file thru a proxy, is there a way in C# to specify a general way of coding to handle proxy and non-proxy users? ...
0
9644
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10793
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10509
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7757
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6954
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5626
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4427
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 we have to send another system
2
3977
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3081
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.