2013-08-15 46 views
13

Özel C# kodu kullanarak bir CRM iş akışından SharePoint web hizmeti aramaya çalışıyorum. Benim kod çalıştırmasına Ancak, aşağıdaki hatayı alıyorum:Sağlanan URI şeması 'https' geçersiz; Web hizmeti çağrılırken beklenen 'http'

İşte

The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via

kusurlu kodudur:

#region Set up security binding and service endpoint 
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); 
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; 
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm; 
EndpointAddress endpoint = new EndpointAddress(endpointAddress); 
#endregion 

#region Create the client and supply appropriate credentials 
CopySPContents.CopyService.SharepointFileServiceClient client = new CopySPContents.CopyService.SharepointFileServiceClient(binding, endpoint);    
client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; 
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;    
#endregion 

#region Call the web service and trace its response 
String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL); 
#endregion 

hata müşterinin yöntemi denir hat String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL); üzerine atılan. Herhangi bir yardım için

sayesinde BasicHttpSecurityMode için
Scott belgelerinde gereğince

+7

TransportCredentialOnly 'https' ile çalışmaz. 'Https' için Transport veya TransportWithMessageCredential'ı kullanmanız gerekir. –

+0

Teşekkürler, bunu deneyeceğim ve size geri döneceğim – Scott

+0

Çalıştı! Onu nakliyeye değiştirdim ve kusursuz çalıştı. Teşekkürler! – Scott

cevap

30

, TransportCredentialOnly yalnızca HTTP ile kullanılabilir. HTTPS için Transport veya TransportWithMessageCredential'u kullanmalısınız.

İlgili konular