简体   繁体   中英

How to programmatically create WCF service by using existing WSDL file?

I have WSDL file and XSD files and need to programmatically create WCF service.

Programmatically means without using any utility tool such as SvcUtil.exe.

What's my problem here..??

  1. I haven't found anything like that on internet.

  2. I know how to create WCF service using ChannelFactory, but I don't know how to employ existing WSDL file in such a scenario.

  3. There's something about using IXmlSerializable interface and its GetSchema, ReadXml and WriteXml methods, but I'm not sure how to use it.

Thank you in advance.

Goran

SvcUtil.exe doesn't do anything "magical" that you can't do yourself in your own code; It uses public WCF classes to process WSDL and XSD, you can use the exact same classes (for example, System.ServiceModel.Description.WsdlImporter), but unfortunately it's not very easy. Read http://msdn.microsoft.com/en-us/library/ms731768.aspx and its subtopics as a starting point. You can also open up SvcUtil.exe itself in Reflector to look at its code and see how it does certain things. I think there are also some open-source implementations of a "better svcutil", you can look at their code as well, unfortunately I can't remember any details at the moment.

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