Julio César
Julio César

Reputation: 13256

WCF, implementing a web services from an existing schema

I have to implement a SOAP web service that conforms to a (large) standard schema for the travel industry. Here's an example .XSD file:

http://www.opentravel.org/2008B/OTA_HotelAvailRQ.xsd

I think that rules out simply putting a [WebMethod] attribute to a method. How do you recommend implementing an existing schema using C#?

PS: I'm using WCF, C# 3 and the server has .NET 3.5 installed.

Thanks

Upvotes: 1

Views: 674

Answers (2)

John Saunders
John Saunders

Reputation: 161773

You could create the classes with XSD.EXE, and return them from your WCF service (you meant [OperationContract], not [WebMethod]). But you have to configure to use the XML Serializer, not the Data Contract Serializer.

Upvotes: 1

bendewey
bendewey

Reputation: 40235

Have you tried loading the schema using xsd.exe from the Visual Studio Command Line? This generates a file of clr objects.

http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.71).aspx

Upvotes: 1

Related Questions