Skip to content

An alternative way to do SOAP Requests without use the WSDL

License

Notifications You must be signed in to change notification settings

HodStudio/XitSoap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XitSoap

An alternative way to do SOAP Requests without use the WSDL

Bugs CodeSmells vulnerabilities Duplicated Lines sqale_index

sqale_rating reliability_rating security_rating

In 2015, we face a very simple problem: the automatically generated code by Visual Studio to use webservices has a lot of code smells. Facing this problem, we created a library that generates the SOAP requests based on your models, without code smells in your code.

Download it using NuGet

Install-Package HodStudio.XitSoap

Link: https://www.nuget.org/packages/HodStudio.XitSoap

ATTENTION

If you are using the version 1.x from our library, please, read carefully how to upgrade to version 2.x because it is a major refactor to improve some usages. It's nothing complicated, but if you just upgrade from version 1 to version 2, your code will have some problems.

How to use

Create an object of WebService, with the base URL and the namespace that will be used.

var wsCon = new WebService("http://www.webservicex.net/ConvertSpeed.asmx", "http://www.webserviceX.NET/");

Add the parameters to execute your call.

wsCon.AddParameter("speed", 100D);
wsCon.AddParameter("FromUnit", "milesPerhour");
wsCon.AddParameter("ToUnit", "kilometersPerhour");

Add the authentication.

wsCon.SetAuthentication(new BearerTokenAuthentication("myBearerToken"));

Invoke the method, providing the return type.

var result = wsCon.Invoke<double>("ConvertSpeed");

Documentation

For more situations and examples, please, take a look on our Documentation on the Wiki.

To see the planned new features, take a look on our RoadMap.

Download the source code and running

To run the tests, we provide a mock project Web. It should be runned on http://localhost/XitSoap so the tests can try to connect to it. Some of the tests are runned against published web services on the internet. In case you are not connected to the internet, they will fail.