1

I've built a service and corresponding data model in c#. A third party wants to integrate with service. I'm required to provide xsd-schema. The "xsd" tool in VS does the job but somehow namespaces is lost in the process. Is it possible to include the namespaces I've defined on my classes(using the DataContract tag) using the xsd-tool? Is there other tools out there to convert a .cs model to xsd?

Update:

The service is rest api based on json used by serveral client. This issue arrised when I wanted to integrate biztalk with this api. I could manuanly add namespace but this is tedious as it's a huge service contract that change alot.

magnarwium
  • 235
  • 2
  • 14
  • I assume you don't want to manually set the namespace in the XSD file after generating it? – D Stanley Feb 13 '15 at 14:06
  • What language are they using to call your service, its likely to be a manual process but this is a pain if you ever change the service. Is the service an API or just a generic service. – krystan honour Feb 13 '15 at 14:47
  • 1
    `xsd.exe` is an old tool originally designed for `XmlSerializer` attributes including [`XmlRoot`](https://msdn.microsoft.com/en-us/library/x6c1kb0s%28v=vs.110%29.aspx). If you're using data contract attributes, you could try the answer here: https://stackoverflow.com/questions/2604032/is-there-a-way-to-export-an-xsd-schema-from-a-datacontract – dbc Feb 13 '15 at 22:44

1 Answers1

0

Based on the suggestions from @dbc svcutil turned out to be the solution. Using the datacontract only flag I was able to generate service model containing correct namespace references.

magnarwium
  • 235
  • 2
  • 14