Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Soap Call web service in Dynamics 365

(0) ShareShare
ReportReport
Posted on by

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);
                   //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 = 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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans