Reputation: 1789
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:
gatewayService.SendRequest(request);
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:
[MessageBodyMember]
public ReportCommandLineRequest ReportRequest { get; set; }
[MessageBodyMember]
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"
xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<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>
</s:Header>
<s:Body>
<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:
<ReportCommandLineRequest>
<outputFileName>gatewayReportOutput-01082010-150043.pdf</outputFileName>
<CommandLineArg
name="format"
..
</ReportCommandLineRequest>
Can anyone please help me to figure out how can i do that?
Thank.
Upvotes: 0
Views: 2243
Reputation: 754200
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:
Upvotes: 5