Good Day,
I am strugging with calling a Soap web service within CRM plugin.
I have added the service reference and my struggle is after instiatiating the client what do I do next.
I need to call this web services,find out if I am getting something read to stream and then call a specific methog within the webservice that takes 2 integer parameters.
I have been doing some research and I found the code on the following site .
And have questions as per below
public
SOAPServiceResponse CallAddressValidation(ITracingService tracingService,
string
serviceURL,
string
serviceUserName,
string
servicePassword,
string
crmUserName,
string
addressLine,
string
city,
string
state,
string
postalCode)
{
BasicHttpsBinding binding =
new
BasicHttpsBinding();
EndpointAddress address =
new
EndpointAddress(serviceURL);
ServiceSoapClient soapClient =
new
ServiceSoapClient(binding, address);
soapClient.ClientCredentials.UserName.UserName = serviceUserName;
soapClient.ClientCredentials.UserName.Password = servicePassword;
SOAPServiceRequest requestType =
new
SOAPServiceRequest();
using
(OperationContextScope scope =
new
OperationContextScope(soapClient.InnerChannel))
{
HttpRequestMessageProperty httpRequestProperty =
new
HttpRequestMessageProperty();
httpRequestProperty.Headers[HttpRequestHeader.Authorization] =
"Basic "
+
Convert.ToBase64String(Encoding.ASCII.GetBytes(soapClient.ClientCredentials.UserName.UserName +
":"
+
soapClient.ClientCredentials.UserName.Password));
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
//
//Pass request data
//
var
serviceResponse = soapClient.ValidateService(requestType);
return
serviceResponse;
}
Any help will be greatly appriciated.
*This post is locked for comments