I’m trying to find a way to read in a WSDL file (I will not have the source of the service) that requires a custom type as input.
I am currently trying to test with this file http://www.webservicex.net/CurrencyConvertor.asmx?WSDL
So in this I am dynamically calling the ConversionRate method. I input two strings for the “ToCurrency” and “FromCurrency” fields needed and then I use String.Format and create a class named the same as the expected one “Currency” in this case and I’ve made the to/from currency as public strings in the class I create and set them to the two input strings I gave in the beginning. When I try to invoke the service this way I get an error like cannot convert type Currency to Currency.
I assume this is because the class I’ve created is not the same as the one implemented in the code for the service I’m calling.
My question is this, can I create a class of the appropriate type to successfully pass in and invoke the method using only the data I get from the WSDL file?
Use Microsoft’s wsdl.exe link.
The tool can be found in your Microsoft SDK folder under program files. If all you want is to consume the web service, then Jen’s suggestion is best imho.