Reputation: 2107
Is there some methods to create SOAP-requests and to get SOAP-responses in .net-4.5? Which extentions I should to install, if it's necessary?
Upvotes: 0
Views: 2496
Reputation: 22271
You can use SOAP services via the "Add Service Reference" function in Visual Studio. Behind the scenes, this will call svcutil
to convert the .wsdl
into .cs
service prototypes.
The .Net Framework includes both WCF, which is the newer and recommended network communication framework, as well as .Net Remoting, which is more compatible with some non-.Net SOAP endpoints.
See
MessageHeader
s to a WCF Call (MSDN Blog)For the service located at http://www.webservicex.net/currencyconvertor.asmx?WSDL:
svcutil http://www.webservicex.net/currencyconvertor.asmx?WSDL
move output.config program.exe.config
Program.cs:
using System;
using www.webservicex.net;
class Program
{
public static void Main(string[] args)
{
var client = new CurrencyConvertorSoapClient("CurrencyConvertorSoap");
var conv = client.ConversionRate(Currency.USD, Currency.EUR);
Console.WriteLine("Conversion rate from USD to EUR is {0}", conv);
}
}
csc Program.cs CurrencyConvertor.cs
c:\Drop\soaptest>Program.exe
Conversion rate from USD to EUR is 0.7221
Upvotes: 2