web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans