tesicg
tesicg

Reputation: 4053

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

Upvotes: 0

Views: 1091

Answers (1)

Eugene Osovetsky
Eugene Osovetsky

Reputation: 6541

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.

Upvotes: 1

Related Questions