I'm trying to automate a build procedure, and need it to generate a web reference for my web service. Now I know I can use wsdl.exe and pass in the URL ... however, I have the requirement that the build machine not require IIS to be setup. Which means I can't use a URL ...
So does anyone know how I can generate a web reference without using a URL
I've tried used xsd.exe (since wsdl.exe will accept a .xsd file). But I can't seem to get that working - it just gives me errors about the Global class and the System.ComponentModel.MarshalByValueComponent.Site method.

Generate a Web Reference without a URL
GerryT
You can use wsdl.exe and just browse to a local .wsdl file. Do you already have the WSDL file for the web service If not then here is what you could do:
1. Browse to your server that has the web service using .asmx wsdl
2. Within the browser copy the contents of the generated wsdl content and paste it into notepad
3. You'll have to modify the text copied so that it doesn't have the extra '-' characters that internet explorer will add to it.
4. Then just save off that text into a .WSDL file. At this point you have an external WSDL file that describes your web service.
5. Now you can just pass that into the wsdl.exe command line to generate the proxy class like so:
wsdl.exe mySavedWsdl.wsdl
NOTE:
If your wsdl file references external XSD files, then you may also need to add those to the command line:
wsdl.exe mySavedWsdl.wsdl types1.xsd types2.xsd ....
Let me know if this makes sense, or if you have other requirements for your solution.
Cheers
-Todd Foust
cjarvis
The problem is step 1 ... you're requiring a URL.
The build can't assume the web service is up on any particular server. (For that matter, the developer could've just checked in a change to the service, so any server that does have it up would be out of date anyway).
Yes, I could require that the developer check in a .wsdl file for the build to use ... but that has it's own problems. For one, it's one more thing they might forget - but if it was a one-to-one type of thing, I might consider that. However, consider this - I have a project which defines an AuthenticationToken - basically just a class containing the info needed to connect to the DB. Now, that AuthenticationToken will get passed in to pretty much every web service we create. Which means a change to the AuthenticationToken would require updating the .wsdl for every web service!
So I really need to automate this entire procedure, and I need it to be done without a URL. If necessary (and it's looking like it is ...), I'll use Reflection to parse the dll and create the reference myself. But I'd rather not do that ...