31.05.2013, 14:52 | #1 |
Moderator
|
Подключение к CRM на чистом WCF через HTTPS
Коллеги, подскажите кто пробовал реализовать подключение к CRM c использованием базовых классов WCF без использования сборок SDK? Важный момент состоит в том, что сервер доступен только по httpS.
Сервер сконфигурирован корректно, так как:
Иными словами требуется код наподобие: X++: String serviceUrl = "https://server/org/XRMServices/2011/Organization.svc"; SymmetricSecurityBindingElement security = new SymmetricSecurityBindingElement(new SspiSecurityTokenParameters()); HttpsTransportBindingElement https = new HttpsTransportBindingElement(); https.MaxReceivedMessageSize = 10000000; CustomBinding binding = new CustomBinding(); binding.Elements.Add(security); binding.Elements.Add(https); OrganizationServiceClient client = new OrganizationServiceClient(binding, new EndpointAddress(serviceUrl)); OrganizationRequest whoAmI = new OrganizationRequest(); whoAmI.RequestName = "WhoAmI"; client.Execute(whoAmI); client.Close(); X++: String serviceUrl = "https://server/org/XRMServices/2011/Organization.svc"; WSHttpBinding b = new WSHttpBinding(); b.Security.Mode = SecurityMode.Transport; b.MaxReceivedMessageSize = 10000000; OrganizationServiceClient client = new OrganizationServiceClient(b, new EndpointAddress(serviceUrl)); OrganizationRequest whoAmI = new OrganizationRequest(); whoAmI.RequestName = "WhoAmI"; client.Execute(whoAmI); client.Close(); Цитата:
An error occurred when verifying security for the message
Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at CrmWcfTestConsoleApplication.CrmServiceReference.IOrganizationService.Execute(OrganizationRequest request) Буду признателен за помощь всеми возможными очками репутации!
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. MS Certified Dirty Magic Professional |
|
|
|