Call a Web Service from a Command-Line

For all you command-line freaks out there, I hope you know about Microsoft's scripting technologies. Hopefully you are also aware that web services is the hot new thing and is certainly a great way to architect solutions these days. So, combining those two things (WS+Script), here is how to call a web service from a command-line via script:

Save the following as MSFT.vbs:

set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit ""
WScript.Echo "MSFT = " & SOAPClient.GetQuote("MSFT")

Then from a command prompt, run:


After a few seconds, (it has to hit the web server, which gets the data, then sends it back to you) a text box will pop up with the XML that is returned from the web service, which in this case, tells you the current stock information for Microsoft.

Thanks to for making the web service available.
Thanks to for giving the example (with a web service that no longer existed, so my example is sort of an update to that one)

Find a TON of very cool scripts on the TechNet Script Center.

I'm sure someone out there can come up with a useful example based on this idea. Want to give me some of those ideas? Better yet, want to write some and share them with me?

Comments (2)
  1. Ian Morrish says:

    Thanks for letting me know about the out of date web service. These free web services come and go all the time…

    Windows SharePoint Services is another great way to consume web services. Just use FrontPage 2003 to add a data source and a Data View web part to render the results just how you want. See for a demo.

Comments are closed.

Skip to main content