Quantcast
Viewing all articles
Browse latest Browse all 2504

Unable to connect to soap wsdl in C# (3 Comments)

Topic by Jason Raynor

Hi,

I am trying to connect to the soap wsdl in vs210 from a addin but cannot compile my code as it is throwing a error with the ClientCredentials.

 

I am using the same code which has been posted on this form and is in the technical documentation.

 

            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

            binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

            EndpointAddress endPointAddr = new EndpointAddress("https://<site>/cgi-bin/<interface>.cfg/services/soap");

            _client = new RightNowSyncPortClient(binding, endPointAddr);

           

            _client.ClientCredentials.UserName.UserName = "Connect";

            _client.ClientCredentials.UserName.Password = "Connect";



            BindingElementCollection elements = _client.Endpoint.Binding.CreateBindingElements();

            elements.Find<SecurityBindingElement>().IncludeTimestamp = false;

            _client.Endpoint.Binding = new CustomBinding(elements);

 

I am getting the below error:

'DM_Course_Selection.RightnowServiceReference.RightNowSyncPort' does not contain a definition for 'ClientCredentials' and no extension method 'ClientCredentials' accepting a first argument of type 'DM_Course_Selection.RightnowServiceReference.RightNowSyncPort' could be found (are you missing a using directive or an assembly reference?)

Works fine if I use visual basic, but not c#

Any help would be much appreciated


Viewing all articles
Browse latest Browse all 2504

Trending Articles