简体   繁体   中英

Generate Windows Forms from WSDL

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?

If this is for testing only I would suggest the excellent SOAP UI tool and the free version is capable enough but only the pro version has a GUI based input. The other tool I have used briefly is WCF Storm .

Otherwise take a look at this test client code that is very similar to what you want http://www.larswilhelmsen.com/2008/10/04/wcf-test-client-extended/

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 CSharpCodeProvider class to compile the code, and build a ServiceDescription to load the WSDL, then generate the code using the ServiceDescriptionImporter class 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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM