for example the following command:
$> svcutil http://localhost/MyServices/Service.svc?WSDL
will generate Service.cs which is the proxy you can add to your project.
Sometimes the wsdl file is not on a url but on the local disk. In theory this should work:
$> svcutil c:\services\calc.wsdl
In practice this would work only if the wsdl does not reference other wsdl or xsd files (even if their relative reference is correct). The same would work with "add service reference" in VS so not sure why it fails here. One solution is to explicitly specify all the referenced schema files in the command:
$> svcutil" c:\services\calc.wsdl" "c:\person.xsd c:\units.xsd"
This usually works but requires manual work and is not always desired when a large number of references is used.
An alternative would be to upload the wsdl and the references to a web server and svcutil from there. If you have iis on your dev machine this is actually pretty simple:
1. copy the wsdl root folder to a subfolder under c:\inetpub\wwwroot
2. run
$> svcutil http://localhost/root/calc.wsdl
That's all, no need to specify all files. svcutil works well from url locations. Do not forget to remove the wsdl folder after so your iis folder would stay clean. What's next? get this blog rss updates or register for mail updates!
6 comments:
That's very clever. :)
Awesome!
Can you not just put all of your wsdls/xsds in the same folder and use *.wsdl *.xsd? This will then look at all WSDL and XSDs in the directory for the references.
Can you not just put all of your wsdls/xsds in the same folder and use *.wsdl *.xsd? This will then look at all WSDL and XSDs in the directory for the references.
I believe this will also work
your blogs clear me some points, if the new service.cs created by wsdl/svcutil command how would i utilize the code means the command returns me a very long service.cs file
Please see reference:
http://forums.asp.net/t/1831357.aspx/1?create+service+skelton+from+WSDL+file
Post a Comment