Questions tagged [iclientmessageinspector]
17 questions
9
votes
2 answers
How to get the invoked operation name within a IClientMessageInspector?
I implemented an IClientMessageInspector to "intercept" outgoing web service call in my application. Is it possible to find out which operation is being called from inside the BeforeSendRequest and AfterReceiveReply?
There is a similar question…

Louis Rhys
- 34,517
- 56
- 153
- 221
7
votes
2 answers
How to cancel a request in BeforeSendRequest
When using the IClientMessageInspector interface, can I cancel a request from the BeforeSendRequest method? Returning null sends the request anyway.
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
if(Condition)
…

Benjamin
- 129
- 8
3
votes
2 answers
POSTing application/x-www-form-urlencoded to a SOAP / JSON WCF service
Background
I wrote a WCF service a while ago that makes heavy use of custom operation invokers, error handlers, and behaviors - many of which heavily rely on the input message being of a certain type, or the message's base message type (each…

Spikeh
- 3,540
- 4
- 24
- 49
2
votes
1 answer
Inject new xml using BeforeSendRequest from IClientMessageInspector
I would like to "inject" a custom XML text using BeforeSendRequest method from IClientMessageInspector. Here is the code I tried:
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
String myXML =…

KingOfBabu
- 409
- 3
- 21
2
votes
2 answers
WCF IClientMessageInspector Logging Discrepancy Regarding Action
I am logging outgoing WCF Soap requests from my application, and discovered a discrepancy between what I'm logging and what actually goes out to the server via the wire.
Here is what I'm logging:

johnivers
- 383
- 1
- 10
2
votes
1 answer
IClientMessageInspector not working in WCF
I have a class MessageInspector which implements IClientMessageInspector.
namespace WCFAuthentication
{
public class MessageInspector : IClientMessageInspector
{
public void AfterReceiveReply(ref System.ServiceModel.Channels.Message…

Asheesh Garg
- 46
- 1
- 4
1
vote
1 answer
How can I return XML from BeforeSendRequest and AfterReceiveReply to the calling method in a thread-safe way?
We have a console application using the Azure WebJob SDK. The WebJob relies on a WCF service using SOAP, which it accesses through a DLL we wrote that wraps the auto-generated WCF types in something a bit more friendly.
For logging purposes, we want…

Chris Akridge
- 385
- 3
- 14
1
vote
1 answer
WCF - How to invoke Message Inspector before Service Authorization Manager?
We are using Message Inspector to customize the SOAP message by adding some information at client side and retrieving the added information at the server side.
We are also using Custom Authorization Manager by using ServiceAuthorizationManager to…

sanyam9999
- 31
- 3
1
vote
1 answer
OperationContextScope vs MessageInpectors
Help me in understanding differences between these two. as per to me, Operation
ContextScope can be used irrespective of .NET application you are using like WCF, Console, Web, etc, anywhere this can be used if you are calling any other service like…

user3264937
- 81
- 14
1
vote
3 answers
Claims in Thread.CurrentPrincipal are getting lost which are set in AfterReceiveRequest in WCF
I am using Microsoft.IdentityModel.dll for Set & Get the claims in WCF. I have implemented MessageInspectors also for setting up the claims. So, I am adding ClaimsIdentity for request headers like below from client side.
public object…

Prasad Kanaparthi
- 6,423
- 4
- 35
- 62
0
votes
0 answers
.NET Core Request REST MessageInspector
I have a backend application in .NET Core 6 that makes calls to different external services. Until now it was all SOAP calls.
I used a class that inherited from IEndpointBehavior and this in turn used a class of its own that inherited from…

daicon
- 181
- 3
- 15
0
votes
0 answers
How to forward request from one WCF to another WCF?
I have a situation where I have to create a service A (kind of a Proxy service) which will in turn calls another service B (the real service). The client C will only know the service A. Service A will log the call and would just kind of forward the…

Sujoy
- 802
- 11
- 22
0
votes
1 answer
Tracking/Checking WCF client message
I send a message from my client (implements IClientMessageInspector) using BeforeSendRequest() and receive the reply from the endpoint at AfterReceiveReply().
My question is what is the most effective way to "validate" the reply that I receive is…

Johnny Wu
- 1,297
- 15
- 31
0
votes
1 answer
Handle exception on IClientMessageInspector
I have calling wcf service and I implemented IClientMessageInspector interface.
I want to handle error on AfterReceiveReply. The fault exception should always return 200 status code with custom message and error code. It should not throw any…

Imrankhan
- 157
- 1
- 8
0
votes
1 answer
Replay log using WCF technology
I need to replay some logs saved in JSON in .NET with WCF technology. The software use IClientMessageInspector to obtain the logs and
save them in JSON afterwards. So, I need to get this logs and inject them again. To do this,I did something similar…

KingOfBabu
- 409
- 3
- 21