Bug 11480 - System.ServiceModel.Channels.Message duplicated body.
Summary: System.ServiceModel.Channels.Message duplicated body.
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-29 17:56 UTC by Šarūnas Gliebus
Modified: 2014-03-07 09:39 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Šarūnas Gliebus 2013-03-29 17:56:05 UTC
In function WriteBodyContents (XmlDictionaryWriter writer) //In file "mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs",  line ~164

First 'copied_message' variable body is written, latter message body itself is written again. That results in duplicated message body content.

Current code:
	if (copied_message != null)
		copied_message.WriteBodyContents (writer);
	OnWriteBodyContents (writer);

I think i should be replaced into:
	if (copied_message != null)
		copied_message.WriteBodyContents (writer);
	else
		OnWriteBodyContents (writer);

Otherwise reply message body gets duplicated.
Tested on mono versions 3.0.6, mono 2.11.4 and 2.10.8.
On mono version 2.10.8 I could not reproduce this problem. 

Tested with self-hosted wcf service.

Request example:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
	<s:Header>
		<Security s:mustUnderstand="1" xmlns="http://softdent.lt/apap/security/">
			<ClientCredentials>
				<Username>some_usr</Username>
				<Password>secure_pwd</Password>
			</ClientCredentials>
		</Security>
	</s:Header>
	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
		<GetVersion xmlns="http://softdent.lt/apap"/>
	</s:Body>
</s:Envelope>


Response example:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetVersionResponse xmlns="http://softdent.lt/apap">
         <GetVersionResult>apap-proxy-service-Softdent.Communication.Service.Host (1.0.0.0)</GetVersionResult>
      </GetVersionResponse>
      <GetVersionResponse xmlns="http://softdent.lt/apap">
         <GetVersionResult>apap-proxy-service-Softdent.Communication.Service.Host (1.0.0.0)</GetVersionResult>
      </GetVersionResponse>
   </s:Body>
</s:Envelope>

Patch mentioned above fixes the problem, however I'm not sure if doesn't break something else :)

Note You need to log in before you can comment on or make changes to this bug.