.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to pass response or fault soap message to other end point using WCF?

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :WCF

I have changed the ReplyTo and FaultTo of SOAP Message Headers in WCF ,

and I d like  the response message can be sent to other service endpoint,

I tested it,But Response Message could not be sent to other service.

How can I make it?

Thanks in advance.


Frank Xu Lei--????,????
Focus on Distributed Applications Development and EAI based on .NET




View Complete Post

More Related Resource Links

How to Add Custom SOAP Headers Into The Server Response Message in WSE3.0?

Hi Dear All, Assuming I am the service provider, may i know how many ways are there to insert a custom header into the server response message? So far I tried several ways, and it can be done in custom SoapFilters (by playing with SOAPEnvelope object), and SoapExtension (SOAPMessage object). Just wondering if this could be done at web service class by specifying a SOAPHeader attribute, just like adding a SOAPHeader into the SOAP request message at consumer side? If can, it might be much smarter than SoapFilter and SoapExtension.   Thanks in advance!   Best Regards, Charles

Secure It: WS-Security and Remoting Channel Sinks Give Message-Level Security to Your SOAP Packets


As more organizations adopt XML-based Web Services, the need for message-level security has become evident. WS-Security, now supported in the Microsoft .NET Framework, addresses this need. Using the WS-Security framework, developers can implement channel sinks to intercept Remoting messages as they pass through the .NET Remoting infrastructure. The sink can read the message, change it, and pass it along. During this process, the message can be signed for added security. This article explains how to implement a Remoting channel sink that will modify the Remoting message by including a UserName token in the header, then sign the body using the token.

Neeraj Srivastava

MSDN Magazine November 2003

DIME: Sending Files, Attachments, and SOAP Messages Via Direct Internet Message Encapsulation


Direct Internet Message Encapsulation (DIME) is a new specification for sending and receiving SOAP messages along with additional attachments, like binary files, XML fragments, and even other SOAP messages, using standard transport protocols like HTTP. In this article, the author explains what DIME is and how it differs from MIME encapsulation. A detailed description of the message format and how it is parsed, as well as working with SOAP and extending it with WSDL, is also included.

Jeannine Hall Gailey

MSDN Magazine December 2002

FaultContract - can I use non soap fault messages

I want to use the FaultContract functionality for reporting errors but I want to completely define the message on the wire (as I do in the MessageContract) - I do NOT want the message to appear as a soap fault on the wire.  Is that possible?  I guess what I really want is for a contract to have two possible results, the normal successful result and a specialist exception result.  This is for something to go through an XML guard and a soap fault doesn't meet the IDL spec.   I'd be grateful for any pointers   Thanks

Need help in reading Soap request and response on invoking WCF client assembly

Hi All,   I'm new to WCF and i'm using .Net 3.5. I have created a library from the proxy class generated through svcutil. I'm able to succesfully invoke service methods. I was wondering how to capture the request and response soap xmls so that i could render it on browser. If you have any code piece for this kind of problem please share it with me. Regards, Rahul

WCF Message Inspectors and Response Headers

I have a question about setting http headers in a wcf message inspector. My requirement is to record the size of the results of a wcf call by our partners to our server to a log file for analysis. When the call is made our partners send in various info in the http headers such as their vendor id. I can of course see this fine during the AfterReceiveRequest, but not in the BeforeSendReply call. Is there a way to set the response https headers during the AfterReceiveRequest? Or is there another way to do this? Thanks, DavidMicrosoft MVP

ASMX web service soap fault

Hi,I have a ASMX web service, and as I understand the ASMX services does not include soap fault details in the WSDL.Thus, I have changed the generated WSDL to include soap fault.Will this cause any error in the endpoint systems?Regards, 

WCF TCP-IP End Point Error : The message could not be dispatched because the service at the endpoint

"The message could not be dispatched because the service at the endpoint address 'net.tcp://' is unavailable for the protocol of the address." This is the Exception I am getting when I am trying to access my WCF Service with 'TCP-IP' end point. My Service Web.Config file is as follows. <system.serviceModel>     <bindings>       <webHttpBinding>         <binding name="JsonWebBinding">           <security mode="TransportCredentialOnly">             <transport clientCredentialType="Windows"></transport>           </security>         </binding>       </webHttpBinding>     </bindings>     <services>       <service behaviorConfiguration="SampleBehaviour" name="SeP.Library.ServiceLibrary.TerritoryMgt">         <endpoint address="" behaviorConfiguration="jsonEndPointBehaviour" binding="webHttpBinding" bindingConfiguration="JsonWebBinding"                &nbs

How to change the ReplyTo and FaultTo of SOAP Message Headers in WCF ?

Hi All, How to change the ReplyTo and FaultTo of SOAP Message Headers in WCF ? I will test routing SOAP MEssage using WCF, Thanks.  Frank Xu Lei--????,???? ???.NET????????????????????? Focus on Distributed Applications Development and EAI based on .NET   ???????:http://www.frankxulei.com/ ???????:http://www.cnblogs.com/frank_xl/ ??WCF?????? ??WCF??????

set Response to client from SOAP Envelope



I have a WCF client with a custom behavior that intercepts the SOAP request. In BeforeSendRequest in the client I get the SOAP request and pass it to another WS as parameter. The other WS posts the SOAP envelope to the real service that client wants to invoke and returns the SOAP Response back to client. So in BeforeSendRequest the intermediary service returns the real SOAP response as a string back to client.

public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel)
      string soapResponse = myotherProxy.CallService(request.ToString());
      return null;

How can i set the returned SOAP response (soapResponse) as the real response in the client?

Hope someone can help :)

Thank you, Adrya

view soap request message


I am consuming a .net 2.0 webservice from a class library and calling this class from a web page form . When a user inputs and saves the data in the form it will call the class and inturn send the user inputted data over webservice. I want to view the Soap messages like request and response going from my dll to the webservice. I tried fiddler but with no luck. So I created a class mentioned here: http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension(v=VS.90).aspx

and added the in the dll.config file like this and it was also of no help. By the way the end webservice is https not http.




        <add type="SoapTrace.TraceExtension" priority="2" group="High" />





Any pointers are greatly appreciated, thanks in advance

How to manipulate both envelpe and body of soap message


Can you please help to manipulate the both envelope and body of SOAP message. I am using MessageInspector and in the BeforeSendRequest method,  i have a request like that.

<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
    <a:Action s:mustUnderstand="1">http://www.aaaa.com/IServices/Method</a:Action>
    <Method xmlns="http://www.aaaa.com">
After manipulation i want to create a Message wwhic will have following XML:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12">
		<a:Action s:mustUnderstand="1">http://www.aaaa.com/IServices/Method</a:Action>

WCF returning "The content type text/html of the response message does not match the content type of

I have a WCF service I am trying to run on a new installation of 64-bit Windows Server 2008 IIS. Although it runs fine on Windows 2003 IIS, it is throwing the error in the thread title, which appears to be a server config issue, but I am not sure. Googling and searching the MSDN forums did not turn up a solution. I tried running WCF Logging, but that didn't help either.

Does anyone have any suggestions on how to solve this probelm?

Here is the error:

The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content=&qu

Fetch raw XML for SOAP request and response inside WCF client


I've got a basis WinForms test harness that's implementing a WCF client (.NET 3.5) which calls a SOAP web service.  I need to be able to write the HTTP request and response and output the two XML documents so I can load them back into WebBrowser controls on the form.

It looks like the way to accomplish this is to implement a custom IClientMessageInspector and an IEndpointBehavior, apply the behavior to the binding and then do the work of capturing the XML inside AfterReceiveReply and BeforeSendRequest (inside IClientMessageInspector implementation).

So my questions are:

1. This seems like a rather exhaustive process, is there a more straightforward approach to doing this? 

2.  If I am on the right path, does anyone have links to related articles/code samples related to this?

3. In what I have coded so far, I am held up trying to get the behaviorExtension to register properly (inside app.config), it looks as if I must register my classes that implement behavior Extenshions in the GAC in order to make use of them, is this true? 

Thanks in advance for taking time away to help a fellow developer!

How to properly create SOAP Request that has x509 signed message body and unsigned usernameToken




I'm trying to  create a .NET client that will consume AXIS WS.

Request should be signed (using x509 Signature) and after this usernametoken profile 1.0 should be attached.

Using SOAP-UI I can create Outgoing Security Policy with few steps described below:

1) Define keystore

2) Add WSS Signature entry and mark key identifier type as X509 Certificate or Binary Security Token

3) Add WSS Username entry

The order is important.

I cannot recreate SOAP request that would generate valid response.

I got "The signature or decryption was invalid" most of the time.

Here is valid SOAP Request from SOAP-UI:


 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:user="http://users.api.swd.zbp.pl"

MTOM-enabled WCF service sends document inline in SOAP response


I'm running a WCF service that has messageEncoding="Mtom" in the config file. The WCF service however, in its SOAP response sends the document as a Base 64 encoded document inline and not as a <xop:include.....> reference outside the SOAP. I'm not sure what I'm doing wrong. Please guide me.


Desired Format:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_F862C3E04D9E35266C1256303956115; type="application/xop+xml"; start="0.urn:uuid:F862C3E04D9E35266C1256303956116@apache.org"; start-info="application/soap+xml"; action="urn:ihe:iti:2007:RetrieveDocumentSetResponse"
Date: Fri, 23 Oct 2009 13:19:11 GMT

Content-Type: application/xop+xml; charset=UTF-8; type=&

Response.Redirect cannot be called in a page callback error message.


Hi.  I'm using the Dundas Chart Controls in VS 2005.  These controls are built utilizing AJAX.  I have a basic page with a dundas chart control containing a funnel chart.  The funnel contains Quotes, Sales Orders and Invoices.  When the user clicks on the control, I want to determine whether they clicked on Quotes, Sales Orders or Invoices and transfer to the appropriate Details Page.  I've got the code working to determine which transaction type they clicked on; but, I get the "Response.Redirect cannot be called in a page callback." error when the page tries to redirect.  Note: I get a similar issue if I try server.transfer.


 Here's my code:

Dim hitTestResult As Dundas.Charting.WebControl.HitTestResult = Chart1.HitTest(e.X, e.Y)

            If Not (hitTestResult Is Nothing) Then

                Dim clicked As Dundas.Charting.WebControl.DataPoint = hitTestResult.Series.Points(hitTestResult.PointIndex)

                Select Case hitTestResult.PointIndex
                    Case 0

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend