File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/dotnet-svcutil/lib/src
FrameworkFork/System.ServiceModel/System/ServiceModel Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1721,6 +1721,18 @@ private static void AddBasicHttpBindingConfiguration(CodeStatementCollection sta
1721
1721
1722
1722
MaxOutProperties ( statements , resultVar ) ;
1723
1723
1724
+ if ( defaultBinding . MessageEncoding != basicHttp . MessageEncoding )
1725
+ {
1726
+ statements . Add (
1727
+ new CodeAssignStatement (
1728
+ new CodePropertyReferenceExpression (
1729
+ resultVar ,
1730
+ "MessageEncoding" ) ,
1731
+ new CodePropertyReferenceExpression (
1732
+ new CodeTypeReferenceExpression ( typeof ( WSMessageEncoding ) ) ,
1733
+ basicHttp . MessageEncoding . ToString ( ) ) ) ) ;
1734
+ }
1735
+
1724
1736
// Set AllowCookies's default value to true.
1725
1737
statements . Add (
1726
1738
new CodeAssignStatement (
Original file line number Diff line number Diff line change @@ -126,8 +126,12 @@ public override BindingElementCollection CreateBindingElements()
126
126
bindingElements . Add ( wsSecurity ) ;
127
127
}
128
128
// add encoding
129
- if ( MessageEncoding == WSMessageEncoding . Text )
130
- bindingElements . Add ( TextMessageEncodingBindingElement ) ;
129
+ WSMessageEncodingHelper . SyncUpEncodingBindingElementProperties ( this . TextMessageEncodingBindingElement , this . MtomMessageEncodingBindingElement ) ;
130
+ if ( this . MessageEncoding == WSMessageEncoding . Text )
131
+ bindingElements . Add ( this . TextMessageEncodingBindingElement ) ;
132
+ else if ( this . MessageEncoding == WSMessageEncoding . Mtom )
133
+ bindingElements . Add ( this . MtomMessageEncodingBindingElement ) ;
134
+
131
135
// add transport (http or https)
132
136
bindingElements . Add ( GetTransport ( ) ) ;
133
137
You can’t perform that action at this time.
0 commit comments