The Short, Short Version
Can wsdl.exe
generate the exact same files that Visual Studio does when adding a Web Reference?
Alternatively:
What are the Windows CMD commands that will mimic what Visual Studio does when adding a Web Reference?
A Little More Detail
I have a VS2015 project that uses a Web Reference: https://webservices.netsuite.com/wsdl/v2016_2_0/netsuite.wsdl (NetSuite - bleh).
I can add the Web Service reference in Visual Studio (Project -> Add Service Reference -> Advanced -> Add Web Reference -> Enter URL -> Add Reference) and it will generate a whole bunch of .xsd
and .datasource
files:
Everything is useable and happy. Yay.
However, when I use WSDL.exe
, it only generates a single file: NetSuiteService.cs
:
C:\CSharpPlayground\CSharpPlayground>mkdir "Web References\com.netsuite.webservices"
C:\CSharpPlayground\CSharpPlayground>wsdl.exe /:"Web References\com.netsuite.webservices" "https://webservices.netsuite.com/wsdl/v2016_2_0/netsuite.wsdl"
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 4.6.1055.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\CSharpPlayground\CSharpPlayground\NetSuiteService.cs'.
I've poured over wdsl.exe /?
and haven't found anything that looks like it would help me.
Is wsdl.exe
not the right tool for the job?
Background
I am trying to get CI builds working for my project (we self-host a GitLab instance, so I'm using gitlab-ci). The project builds just fine on my development computer because these .xsd
and .datasource
files all exist.
However, they don't exist on the build machine. I found that I can update the WSDL data using a MSBuild target/task thanks to this answer. So I added that to my .csproj
file and it successfully downloads the data from NetSuite - only to a single .cs file rather than the collection. Thus, the build fails.
I could simply check in all of the web reference files to git, but I'd rather not do that unless I absolutely have to.
Update 1 (2017-03-13 15:56 PDT)
@RasmusW below mentioned the newer scvutil.exe
utility. This gets part of the way there - it generates the individual .xsd
files (the .datasource
files might not be needed).
However, the generated .xsd
files are not named correctly. They are using the namespace
value rather than the schemaLocation
value.
For example, in the .wsdl file provided by NetSuite we have:
<xsd:import namespace="urn:types.accounting_2015_2.lists.webservices.netsuite.com" schemaLocation="https://webservices.netsuite.com/xsd/lists/v2015_2_0/accountingTypes.xsd"/>
The generated file is types.accounting_2015_2.lists.webservices.netsuite.com.xsd
rather than accountingTypes.xsd
.
In addition, there are other files generated by VS2015:
NetSuiteService.cs
- This I can get by using
wsdl.exe /out:"Web References\com.netsuite.webservices\\" https://webservices.netsuite.com/wsdl/v2015_2_0/netsuite.wsdl
. It returns the exact same file as what VS2015 creates.
- This I can get by using
Reference.cs
- No idea what this really is or how it's generated. It appears to be very similar to what's in NetSuiteService.cs though.
Reference.map
- This is an xml file that has a bunch of
DiscoveryClientResult
items that map a url to a filename. I assume that this is how Visual Studio gets the names for the .xsd files, but I'm not sure. - Looks something like:
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.SchemaReference" url="https://webservices.netsuite.com/xsd/lists/v2015_2_0/accountingTypes.xsd" filename="accountingTypes.xsd" />
- This is an xml file that has a bunch of