WCF and code generation from WSDL
===

I am writing a "universal" client for Web services, and have hit an unexpected problem. I generate the code for the client dynamically by retrieving the Web services WSDL, and using the following (simplified a little) code to generate the client code:

    ServiceDescription serviceDescription = ServiceDescription.Read(xmlTextReader(WSDL));
    ServiceDescriptionImporter descriptionImporter = new ServiceDescriptionImporter();
    descriptionImporter.ProtocolName = "Soap";
    descriptionImporter.Style = ServiceDescriptionImportStyle.Client;
    CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
    CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider("CSharp");
    codeDomProvider.GenerateCodeFromCompileUnit(codeCompileUnit, Console.Out, new CodeGeneratorOptions());

I am testing this using a simple WCF Web service that exposes two methods:

    [OperationContract]
    int GetInteger();

    [OperationContract]
    string GetString();

If I examine the client-side generated code, then I can see that the GetString() returns a string, but the GetInteger() method returns void! I assume that this is something to do with value and reference types. Is there some way to force the code generator to make the GetInteger() method return an int?

Thanks for any help, Martin

