SOAP xml client - using Visual Studio 2010 C # - how?

I am new to the .NET world, but I need to use VStudio C # 2010 (.NET 4.0) to create a client that requests data from a web service in SOAP Xml format. I was looking for answers here, but even more embarrassed. MSDN says that "Creating XML Web Services Clients" is deprecated for .NET 4.0, meaning WSDL is deprecated. They say use "WCF". I got lost in WCF - too much and too vague. It should be easier than ... And all the examples that I can find on the Internet - they all use WSDL, the "legacy".

The following are the service definitions that I must use to retrieve data from a web service:

request:

POST /catalog.asmx HTTP/1.1 Host: www.somewebsite.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "https://www.somewebsite.com/KeywordSearch" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <KeywordSearch xmlns="https://www.somewebsite.com/"> <searchTerm>string</searchTerm> <resultsReturned>int</resultsReturned> </KeywordSearch> </soap:Body> </soap:Envelope> 

Answer:

 HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> ...some stuff... </soap:Body> </soap:Envelope> 

So, what is the right or at least the most logical way to build this simple client? What tools / libraries / methodologies do you offer for beginners (provided that VS 2010 C #, .NET 4.0 environment)?

+6
c # soap wcf
source share
1 answer

If you have WSDL / XSD to describe this service, or if you can go to the URL to capture this metadata, then WCF with basicHttpBinding is probably your best bet. WSDL is definitely not "deprecated" - if something is out of date, then these are ASP.NET/ASMX web services.

Given the WSDL / XSD or the URL you can connect to, just make the Add Service Reference from Visual Studio, and you should start and run the WCF service call as soon as possible - trust me! You don’t have to know all the WCFs just to call the SOAP web service ... also, with WCF 4.0, a lot of things, especially the configuration, have been greatly improved and simplified.

Regarding resoures: there is the MSDN WCF Developer Center , which has everything from beginners to articles and sample code.

Also, check out the on- screen library on MSDN for some really useful, 10-15 minute pieces of information on virtually any WCF related topic that might interest you.

+5
source share

All Articles