I have set of WCF web services that I need to generate a Windows based test client. Does anyone know of a tool that will take as WSDL and auto generate some basic forms based on what is in the WSDL. Any thoughts as to how I can get a basic form with fields/labels without having to explicitly make a form. Any thoughts?
Share
It can be done. You’ll need to dynamically compile the proxy into an assembly and the reflect off of it and use reflection to build your forms. I’ve done this in the past for ASMX WSDL, haven’t tried it for WCF WSDL yet.
You can use the
CSharpCodeProviderclass to compile the code, and build aServiceDescriptionto load the WSDL, then generate the code using theServiceDescriptionImporterclass and then compile it. This may need tweaking for WCF services, but you can search on those items and probably find some great references. Once you have the proxy classes, it just because an exercise in creating forms on the fly using reflection.I had a very nice WSDL test tool created for this that we used for testing before Microsoft released the WCF Test Client. Unfortunately it’s proprietary so I can’t release the source. Basically, though, I compiled the WSDL, put all the web methods into a list box, and when you selected a web method it would examine the parameters of the web method using reflection and build a form inside of a panel using AddControl().
If you have any questions, just send me a ping and I can email you some code snippets…