I am using WebClient to read wsdl from URI.
WebClient client = new WebClient();
Stream wsdlStream = client.OpenRead(wsdlURI);
ServiceDescription wsdl = ServiceDescription.Read(wsdlStream);
Then I set Namespace and CompileUnit and use ServiceDescriptionImporter's GenerateCodeFromCompileUnit method to generate .cs class file.
Then I compile assembly from it and use reflection to call methods. Problem is, that my created .cs file has additional xml attributes. And additional parameters like:
public void Calc(int a, [System.Xml.Serialization.XmlIgnoreAttribute()] bool aSpecified
When I create assembly from this source file, I get methods with more parameters, than they should have. Original method looks like:
public int Calc(int a, int b)
and method in generated source code looks like:
public int Calc(int a, bool aSpecified, int b, bool bSpecified, out int CalcResult, out bool CalcResultSpecified)
How can I get dynamically generated source file without these additional parameters? So I can compile it to assembly and use reflection to call original methods?