Conecting to WS from Plugins using EarlyBinding

Working for one of my clients i had to develope a plugin that could connect to a Web Service to send SMS´s to some customers depending on some entity values.

I archived these goal by creating a HTTP Binding to the Web service.

BasicHttpBinding myBinding = new BasicHttpBinding();

myBinding.Name = "WsSanPortBinding";
myBinding.Security.Mode = BasicHttpSecurityMode.None;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
myBinding.UseDefaultWebProxy = false;
EndpointAddress endPointAddress = new EndpointAddress("http://server/sms-webapp/sms?wsdl");

WsSanClient wsc = new WsSanClient(myBinding, endPointAddress);

wsc.WebServiceMethod(data);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s