Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svcutil.exe - How to get WSDL

I'm working with a SOAP interface. The interface provider is having trouble getting me the full WSDL (long story). They have asked me to use svcutil.exe to generate everything I need. From what I can tell, svcutil.exe

  • requires windows - I don't have a windows box available
  • generates C# or VisualBasic

It'd be great if it could just spit out a WSDL. Or if there's something I can do from Linux, that would be great too.

Do I have any options from here, or do I just have to wait for the provider to get me the WSDL.

I guess the question is, given a URL and instructions to use svcutil.exe, how can I write code to use a SOAP service only using Linux?

like image 956
three-cups Avatar asked Apr 06 '11 15:04

three-cups


People also ask

How do I use Svcutil exe?

To use svcutil.exe you need to provide the URL of the native endpoint for the Dynamics GP service and the namespace of the service reference you added to your Visual Studio project. Typically, this is "DynamicsGPService". Enter the following on a single line and then press Enter. Use the generated files.

How do I use WSDL to create a WCF service?

Use svcutil.exe with the /sc switch to generate the WCF contracts. This will create a code file that you can add to your project. It will contain all interfaces and data types you need to create your service.


2 Answers

If using linux you could save it via curl

   curl url > service.wsdl

so to get a weatherForcast WSDL

   curl http://www.webservicex.net/WeatherForecast.asmx?WSDL > weatherForcast.wsdl
like image 82
grantk Avatar answered Nov 13 '22 19:11

grantk


@grantk has already demonstrated the easiest method: if you know where the WSDL is hosted, you can simply fetch the document using your tool of choice.

But as you asked specifically about using SVCUtil: you could find a windows box, use SVCUtil to fetch the WSDL, and then return to your linux (and Java?) stack and generate client proxies from that WSDL to call the service using your web service framework of choice.

If the target service supports WS-MetadataExchange or XML Web Service Discovery, SVCUtil will locate and download the WSDL for you: see this HowTo on Microsoft's MSDN web site.

Using the weather forecast service example that @grantk used, you can ask SVCUtil to query the service and download metadata as follows:

svcutil /t:metadata http://www.webservicex.net/WeatherForecast.asmx

(I'm sure there are similar tools to do this using WS-MetadataExchange in the linux world, but my experience is with SVCUtil.)

like image 40
razlebe Avatar answered Nov 13 '22 20:11

razlebe