0

My goal is to implement an api to an external webservice resource, the response format is xml and the scheme is also known.

For example, this is the external resource api:

https://MyProduct.MyDomain.com/webservice/rest/1.0/MyMethod/

And the external resource api's xml scheme:

https://MyProduct.MyDomain.com/xsd/1.0/MyMethodDataTypes.xsd

The xsd is very long and complex, so I would like to avoid copy it by hand into a class response

So in order to de-serialize the response this is what I did:

  1. Using Postman I've requested a demo request.
  2. Copied the xml response.
  3. Using visual studio paste special, I've pasted the xml response as a class.

The problem is that now the class response is built upon only one specific request and does not contain all of the response properties.

So my question is:

Is it possible to create the response class based on the vendor's xsd scheme?

Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91

1 Answers1

2

Yes, it is possible at the command prompt.

xsd.exe your.xsd /classes

The xsd.exe could be usually found along the following location:

"c:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\xsd.exe"

Lots of additional info could be found here: How to generate .NET 4.0 classes from xsd

Yitzhak Khabinsky
  • 18,471
  • 2
  • 15
  • 21