WCF: SvcUtil.exe with imports issue

importsvcutil.exewsdlxsd

One of the requirement in our project is as follows:

We got from client WSDL and XSD files only. Our task is to generate SOAP messages based on these WSDL and XSD files and extract SOAP bodies.

First step we should undertake is to generate client proxy files from given WSDL and XSD files. Main WSDL file has mulitple imports and imported XSD files also have some imports. I've tried to accomplish client proxy files generation by using SvcUtil.exe utility, but the error came up.

I ran SvcUtil.exe in this way:

E:\Projekti\WCF\XSD>svcutil /noconfig rosrazna.ru.xsd.SmevUnifoService.wsdl roskazna.ru.xsd.ResponseTemplate.xsd roskazna.ru.xsd.PGU_ImportRequest.xsd roskazna.ru.xsd.PGU_DataRequest.xsd roskazna.ru.xsd.PGU_ChargesResponse.xsd roskazna.ru.xsd.ExportPaymentsResponse.xsd roskazna.ru.xsd.ExportIncomesResponse.xsd roskazna.ru.xsd.ExportQuittanceResponse.xsd roskazna.ru.xsd.Ticket.xsd

But, this error came up:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.

Generating files…
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.

I have to mention I did not put imports from XSD files imported in main WSDL file in SvcUtil.exe command. I don't know how to put them.

So, how to solve this?

Thank you in advance.

Goran

Best Answer

@Goran, copy all the referenced xsd files to the same location as the wsdl. Then, when using the svcutil from command prompt, list all the xsds there, or put a *.xsd, like this:

E:\Projekti\WCF\XSD>svcutil /noconfig goransWsdl.wsdl *.xsd

PS: You already seem to be mentioning all the xsds though.

Related Topic