title: WCF woes: request and response classes
body: <p>Could someone <em>please</em> explain to me how the request and response model works in WCF? I have a simple service that exposes a method called getRateOfExchange with a single integer parameter that returns rateOfExchange[], but the Reference.cs file that is generated from the service contains lots of classes:</p>
  
  <p>getRateOfExchange (seems to be the parameters)</p>
  
  <p>getRateOfExchangeRequest</p>
  
  <p>getRateOfExchangeResponse</p>
  
  <p>I have tried every permutation of these classes and their methods but nothing works. Intuitively you would expect to create a request object with the parameter object as a parameter, and then pass this request to the method on the response that executes the request to the sever.</p>
  
  <p>But no.</p>
  
  <p>It has to be painful.</p>
  
  <p>Can someone please explain?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thank you Gigi, but my classes don't look like that.</p>
  
  <p>If I follow your model, my request would look like this:</p>
  
  <pre><code>CharterServices.charterServiceClient proxy = new CharterServices.charterServiceClient();
  
  using (OperationContextScope scope = new OperationContextScope(proxy.InnerChannel));
  {
      using (proxy as IDisposable)
      {
          var response = proxy.getRateOfExchange()
      }
  }                    
  </code></pre>
  
  <p>However, my getRateOfExchange() method requires a getRateOfExchange object, so the above code doesn't compile.The getRateOfExchange class contains parameters that are the parameters to the proxy.getRateOfExchange() method. I have tried creating an instance of this class and passing it the above method, like this:</p>
  
  <pre><code>using (proxy as IDisposable)
  {
      var rateOfExchange = new Service.getRateOfExchange()
      {
          charterEnquiryId = 1550003668
      };
  
      using (OperationContextScope scope = new OperationContextScope(proxy.InnerChannel));
      {
          using (proxy as IDisposable)
          {
              var response = proxy.getRateOfExchange(rateOfExchange);
  
              foreach (var rateOfExcchange in response)
              {
                  Debug.WriteLine(rateOfExcchange.fromCurrencyName);
              }
          }
      }                    
  }
  </code></pre>
  
  <p>but it hangs when trying to call getRateOfExchange().</p>
  
  <p>Aaargh! I know the service is working because I can execute a request in SoapUI to the same WSDL.</p>
  
  <p>Can you help?</p>