Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consuming webservice having WSDL and XSD files

We've requested a company to write a webservice that we can use to get some information.They have sent us WSDL and XSD files. Could you please tell me how I can use these files to query data? I can do it easily if I have a link to a webservice. I just provide the link and Visual Studio generates web reference for me. After that I can use that reference just like a normal class. In this case I have no link. Just above mentioned files. Thank you.

like image 781
Mikayil Abdullayev Avatar asked May 25 '12 11:05

Mikayil Abdullayev


2 Answers

You can create a proxy (add service reference in visual studio) from a wsdl file. You can read about svcutil at http://msdn.microsoft.com/en-us/library/aa347733.aspx, but VS2010 allow you to put a wsdl file on adress when adding service reference.

like image 131
vasile.minea Avatar answered Oct 07 '22 15:10

vasile.minea


VS2010 can't create a web service reference from some WSDLs. Have to write custom wrapper for those. OR edit your WSDL in a way so VS can consume it. For example it may be ok for you to remove web service method references for the methods that you are not planning to use if those references create trouble for you.

Unless you're stuck with .NET 2.0, you should not use ASMX web service technology.

You should use "Add Service Reference" and point it to the WSDL on disk. It will create a set of "proxy" classes with methods that you can call just as though it were a "normal" class.

See "How to Consume a Web Service" for a walkthrough with example.

Use WSDL.EXE utility to generate a Web Service proxy from WSDL.

e.g.

wsdl /language:CS /n:"Microsoft.SqlServer.ReportingServices2010" http://<Server 
Name>/reportserver/reportservice2010.asmx?wsdl

check this for Creating and Consuming .NET Web Services in 5 Easy Steps Article and then Creating the Web Service Proxy

Ref:
WSDL and consume web service
consume non .NET webservice through WSDL file
How to use a WSDL

like image 33
Niranjan Singh Avatar answered Oct 07 '22 15:10

Niranjan Singh