Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,13 @@ internal TypedMessagePartCodeGenerator(CodeTypeDeclaration typeDecl)

CodeAttributeDeclarationCollection IPartCodeGenerator.AddPart(CodeTypeReference type, ref string name)
{
// Keep generated member identifiers away from the CLR root namespace token.
// This mirrors the XmlCodeExporter behavior for member/property generation.
if (string.Equals(name, "System", StringComparison.Ordinal))
{
name = "SystemMember";
}

CodeMemberField memberDecl = new CodeMemberField();
memberDecl.Name = name = _memberScope.AddUnique(name, "member");
memberDecl.Type = type;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace MessageContractMemberNamedSystem_NS
{
using System.Runtime.Serialization;


[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
[System.Runtime.Serialization.DataContractAttribute(Name="Component", Namespace="http://abc.org/wcf/")]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()]
public partial class Component : object
{

private string NameField;

private int ValueField;

[System.Runtime.Serialization.DataMemberAttribute()]
public string Name
{
get
{
return this.NameField;
}
set
{
this.NameField = value;
}
}

[System.Runtime.Serialization.DataMemberAttribute()]
public int Value
{
get
{
return this.ValueField;
}
set
{
this.ValueField = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://abc.org/wcf/", ConfigurationName="MessageContractMemberNamedSystem_NS.IMyService")]
public interface IMyService
{

[System.ServiceModel.OperationContractAttribute(Action="http://abc.org/wcf/IMyService/Process", ReplyAction="http://abc.org/wcf/IMyService/ProcessResponse")]
System.Threading.Tasks.Task<MessageContractMemberNamedSystem_NS.Response> ProcessAsync(MessageContractMemberNamedSystem_NS.Request request);
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="Request", WrapperNamespace="http://abc.org/wcf/", IsWrapped=true)]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()]
public partial class Request
{

[System.ServiceModel.MessageHeaderAttribute(Name="System", Namespace="http://abc.org/wcf/")]
public MessageContractMemberNamedSystem_NS.Component SystemMember;

public Request()
{
}

public Request(MessageContractMemberNamedSystem_NS.Component SystemMember)
{
this.SystemMember = SystemMember;
}
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="Response", WrapperNamespace="http://abc.org/wcf/", IsWrapped=true)]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()]
public partial class Response
{

[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://abc.org/wcf/", Order=0)]
public string Result;

public Response()
{
}

public Response(string Result)
{
this.Result = Result;
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
public interface IMyServiceChannel : MessageContractMemberNamedSystem_NS.IMyService, System.ServiceModel.IClientChannel
{
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()]
public partial class MyServiceClient : System.ServiceModel.ClientBase<MessageContractMemberNamedSystem_NS.IMyService>, MessageContractMemberNamedSystem_NS.IMyService
{

/// <summary>
/// Implement this partial method to configure the service endpoint.
/// </summary>
/// <param name="serviceEndpoint">The endpoint to configure</param>
/// <param name="clientCredentials">The client credentials</param>
static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);

public MyServiceClient() :
base(MyServiceClient.GetDefaultBinding(), MyServiceClient.GetDefaultEndpointAddress())
{
this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IMyService.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}

public MyServiceClient(EndpointConfiguration endpointConfiguration) :
base(MyServiceClient.GetBindingForEndpoint(endpointConfiguration), MyServiceClient.GetEndpointAddress(endpointConfiguration))
{
this.Endpoint.Name = endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}

public MyServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
base(MyServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
{
this.Endpoint.Name = endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}

public MyServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
base(MyServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
{
this.Endpoint.Name = endpointConfiguration.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}

public MyServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}

[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.Threading.Tasks.Task<MessageContractMemberNamedSystem_NS.Response> MessageContractMemberNamedSystem_NS.IMyService.ProcessAsync(MessageContractMemberNamedSystem_NS.Request request)
{
return base.Channel.ProcessAsync(request);
}

public System.Threading.Tasks.Task<MessageContractMemberNamedSystem_NS.Response> ProcessAsync(MessageContractMemberNamedSystem_NS.Component SystemMember)
{
MessageContractMemberNamedSystem_NS.Request inValue = new MessageContractMemberNamedSystem_NS.Request();
inValue.SystemMember = SystemMember;
return ((MessageContractMemberNamedSystem_NS.IMyService)(this)).ProcessAsync(inValue);
}

public virtual System.Threading.Tasks.Task OpenAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
}

#if !NET6_0_OR_GREATER
public virtual System.Threading.Tasks.Task CloseAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
}
#endif

private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
{
if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IMyService))
{
System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
result.MaxBufferSize = int.MaxValue;
result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
result.MaxReceivedMessageSize = int.MaxValue;
result.AllowCookies = true;
return result;
}
throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
}

private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
{
if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IMyService))
{
return new System.ServiceModel.EndpointAddress("http://localhost:63567/Service1.svc");
}
throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
}

private static System.ServiceModel.Channels.Binding GetDefaultBinding()
{
return MyServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IMyService);
}

private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
{
return MyServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IMyService);
}

public enum EndpointConfiguration
{

BasicHttpBinding_IMyService,
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"providerId": "Microsoft.Tools.ServiceModel.Svcutil",
"version": "99.99.99",
"options": {
"inputs": [
"../../../../../src/dotnet-svcutil/lib/tests/TestCases/wsdl/mcMemberNamedSystem.wsdl"
],
"namespaceMappings": [
"*, MessageContractMemberNamedSystem_NS"
],
"outputFile": "Reference.cs",
"targetFramework": "N.N",
"typeReuseMode": "None"
}
}
100 changes: 100 additions & 0 deletions src/dotnet-svcutil/lib/tests/TestCases/wsdl/mcMemberNamedSystem.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://abc.org/wcf/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" name="MyService" targetNamespace="http://abc.org/wcf/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://abc.org/wcf/">
<xs:element name="Request">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:complexType name="Component">
<xs:sequence>
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Value" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Component" nillable="true" type="tns:Component"/>
<xs:element name="System" nillable="true" type="tns:Component"/>
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="Result" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="Request">
<wsdl:part name="parameters" element="tns:Request"/>
</wsdl:message>
<wsdl:message name="Request_Headers">
<wsdl:part name="System" element="tns:System"/>
</wsdl:message>
<wsdl:message name="Response">
<wsdl:part name="parameters" element="tns:Response"/>
</wsdl:message>
<wsdl:portType name="IMyService">
<wsdl:operation name="Process">
<wsdl:input wsaw:Action="http://abc.org/wcf/IMyService/Process" name="Request" message="tns:Request"/>
<wsdl:output wsaw:Action="http://abc.org/wcf/IMyService/ProcessResponse" name="Response" message="tns:Response"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IMyService" type="tns:IMyService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Process">
<soap:operation soapAction="http://abc.org/wcf/IMyService/Process" style="document"/>
<wsdl:input name="Request">
<soap:header message="tns:Request_Headers" part="System" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="Response">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="BasicHttpBinding_IMyService" binding="tns:BasicHttpBinding_IMyService">
<soap:address location="http://localhost:63567/Service1.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
11 changes: 11 additions & 0 deletions src/dotnet-svcutil/lib/tests/src/E2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,17 @@ public void ContractMemberNamedSystem()
TestSvcutil(AppendCommonOptions(wsdlFile));
}

[Trait("Category", "Test")]
[Fact]
public void MessageContractMemberNamedSystem()
{
this_TestCaseName = "MessageContractMemberNamedSystem";
TestFixture();
InitializeE2E(this_TestCaseName);
string wsdlFile = Path.Combine(g_TestCasesDir, "wsdl", "mcMemberNamedSystem.wsdl");
TestSvcutil(AppendCommonOptions(wsdlFile));
}

[Trait("Category", "Test")]
[Fact]
public void ContractTypeNamedReservedKeyword()
Expand Down
Loading