title: Alter WCF client method signatures during generation of service reference
body: <p>I have to use a SOAP web service provided via WSDL definition. After adding Service Reference it results in the following code for operations:</p>
  
  <pre><code>[System.ServiceModel.OperationContractAttribute(Action="http://provided.svc/changeBookingRequest", ReplyAction="http://provided.svc/changeBookingResponse")]
  [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
  [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
  Provided.Service.changeBookingResponse changeBooking(Provided.Service.changeBookingRequest request);
  </code></pre>
  
  <p>The problem is that I want to change signatures so they are capitalized (and change the object type from <code>object</code> and response field from <code>return</code> as they are both reserved keywords in C# and result in <code>@object</code> and <code>@result</code> scattered all across the project):</p>
  
  <pre><code>[System.ServiceModel.OperationContractAttribute(Action="http://provided.svc/changeBookingRequest", ReplyAction="http://provided.svc/changeBookingResponse")]
  [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
  [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
  Provided.Service.ChangeBookingResponse ChangeBooking(Provided.Service.ChangeBookingRequest request);
  </code></pre>
  
  <p>For that purpose I prepared a simple PowerShell script:</p>
  
  <pre><code>$env:WCF='C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools'
  $env:CSC='C:\Windows\Microsoft.NET\Framework\v4.0.30319'
  $env:Path="$env:WCF;$env:CSC"
  
  svcutil /svcutilconfig:app.config /d:OutFolder `
          /t:code https://*****/**Service?wsdl `
          /serializable /reference:'C:\Users\Andrew\****\**.WsdlImport.dll'
  </code></pre>
  
  <p><code>app.config</code> has the following section:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          ...
          &lt;client&gt;
              ...
              &lt;metadata&gt;
                  &lt;wsdlImporters&gt;
                      &lt;extension type="***.WsdlImport.CapitalizeWsdlImporter, ***.WsdlImport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt;
                  &lt;/wsdlImporters&gt;
              &lt;/metadata&gt;
          &lt;/client&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><code>CapitalizeWsdlImporter</code> class implements <code>IWsdlImportExtension</code> but all the relevant properties that I can hypothetically change are read-only. I was only able to change Contract name:</p>
  
  <pre><code>public void ImportContract(WsdlImporter importer, WsdlContractConversionContext context)
  {
      ContractDescription contract = context.Contract;
      contract.Name = "ET" + FirstCharToUpper(contract.Name);
  }
  </code></pre>
  
  <p>I'll be very grateful for help!</p>
  
  <p><strong>P.S.</strong> Ha! While no one is giving reaction to my question, the problem I faced caused me to think much deeper of isolating those ugly classes and service calls in a single project and nothing further, which by now brought only the positive effects.</p>