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
publicSOAPServiceResponse CallAddressValidation(ITracingService tracingService, stringserviceURL, stringserviceUserName, stringservicePassword, stringcrmUserName, stringaddressLine, stringcity, stringstate, stringpostalCode) { BasicHttpsBinding binding = newBasicHttpsBinding(); EndpointAddress address = newEndpointAddress(serviceURL); //What is this is this the client that I am getting from instantitating? soapClient ,if and when do this I cannot find any credentials with on my client how do I get this to work properly ?
ServiceSoapClient soapClient = newServiceSoapClient(binding, address); soapClient.ClientCredentials.UserName.UserName = serviceUserName; soapClient.ClientCredentials.UserName.Password = servicePassword; SOAPServiceRequest requestType = newSOAPServiceRequest(); using(OperationContextScope scope = newOperationContextScope(soapClient.InnerChannel)) { HttpRequestMessageProperty httpRequestProperty = newHttpRequestMessageProperty(); 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 // varserviceResponse = soapClient.ValidateService(requestType); returnserviceResponse; } Any help will be greatly appriciated.





