NealWalters
NealWalters

Reputation: 18227

Can svcutil (or any other utility) convert CS back to XSD?

We have some code that was generated, mostly likely by svcutil from an XML schema (xsd). We don't seem to have the original schema that was used, so we are hoping to reverse the process. I think the XSD utility goes both directions, but what if we are using DataContract serializer? (We are using VS2010 .net 4.0).

Update: Based on @Rene's answer below, I extracted schemas. But for curiosity, seems like I should then be able to turn them back to C# and get the same C# that was used in the interface to my webservice?

Step1: Get Schemas - which was originally all I was asking here:

SVCUtil.exe /t:metadata https://myurl.com/EC_DFService/DFExternalService.svc 

Then thought I would reverse it back, and compare to the C# code I started with:

SVCUtil.exe /dconly /ser:DataContractSerializer tempuri.org.xsd myurl.com.Project.Name.xsd /o:MessageDataRequestReverse.cs 

NOTE: You can also get the URL's to the XSD from the WSDL, and just retrieve them from the browser without using the SVCUtil program, example: https://myrUrl.com/WebDir/MyService.svc?xsd=xsd0 They begin with xsd0, xsd1, xsd2... as many as needed.

Issues:

1) Classes are not in same order (making side-by-compare impossible)

2) Still trying to see if # of classes is even the same

3) Still try to see if the xsd's above can be round-tripped back to the C#, not a 100% match.

Upvotes: 2

Views: 330

Answers (1)

rene
rene

Reputation: 42494

svcutil myServiceHost.exe /serviceName:myServiceName
  • Generate metadata documents for a service, and all associated Service Contracts and data types in an assembly

Upvotes: 1

Related Questions