WCF with Message Serialization

I'm write a simple wcf service that submit request to some gateway to be processed.

The request are being executed by executing something like that:

I'm writing a WCF service that submit a request to some service which expect to get something like this:


where gatewayService is the WCF proxy and request is my own object which inherit form WCF Message object.

The request object has few properties like:

public ReportCommandLineRequest ReportRequest { get; set; }

public ImportCommandLineRequest ImportRequest { get; set; }

My problem is when this request object is being serialized. On the server side i'm getting a big chunky soap message that looks like that:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" 
      <a:Action s:mustUnderstand="1">http://tempuri.org/IReportClient/RunReport/IGatewayAdapter/SendRequest</a:Action>
      <VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo4jiWNjcsdxHiUhlOA63xYEAAAAApgt+BuVvcEixP33+yOQTgRHZQSyr4L5ImMHVeEWLFBMACQAA</VsDebuggerCausalityData>
      <a:To s:mustUnderstand="1">net.tems://localhost:7222/queue/LB.FIA.Gateway.STAGE.InputQueue</a:To>
      <SendRequest xmlns="http://tempuri.org/IReportClient/RunReport">
          <request xmlns:b="http://schemas.datacontract.org/2004/07....

On the other hand, i expect on the server side to get only the serialization of the properties listed above (ReportRequest/ImportRequest), and hoping to get a serialized xml looks like that (without all the garbage inside:


Can anyone please help me to figure out how can i do that?



WCF IS a SOAP based message service - so the fact you're getting a "big chunky soap message" is sort of "by design", really!

But what's the problem really?? SOAP is a well-defined protocol, and every decent web service platform speaks and understands SOAP.

Plus, typically, in WCF, you don't deal with "raw" messages anyway - you define your data structures that your service and client exchange, you define classes as [DataContract] that gets sent back and forth, and you let WCF and SOAP handle all the nitty-gritty details of serializing and deserializing your message from and to XML. Typically, you don't have to deal with any of that at all.

So once again: what is really the challenge or question here? WCF is SOAP (and now also REST) - so why does that SOAP message surprise you or cause problems??

WCF also supports handling "raw" messages, and it allows you to do things like extract the body from a SOAP message and so forth (or tweak it otherwise). See some of these blog posts for some pointers on what is possible and what you can do:

Need Your Help

How to remove embedded braces in Java string?

java regex string replaceall

I have a Java string that may contain "{" and "}" pairs, multiple times, inside a larger string:

Display a picture uploaded to the server

c# asp.net-mvc

I am trying to create a user profile picture in a ASP MVC5 project. I have added a page that is called changepicture.cshtml and will display the current user's picture.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.