2011-07-21 11 views
50

मैं एक शुद्ध डब्ल्यूसीएफ परिदृश्य को लागू करने की कोशिश कर रहा हूं जहां मैं डायनेमिक्स सीआरएम डब्ल्यूसीएफ सेवा को एसडीके सहायक वर्गों पर भरोसा किए बिना कॉल करना चाहता हूं। असल में, मैं डायनेमिक्स सीआरएम 2011 के खिलाफ संघीय प्रमाणीकरण को .net फ्रेमवर्क से केवल मूल डब्ल्यूसीएफ समर्थन का उपयोग करना चाहता हूं।क्या एसडीके के बिना डायनेमिक्स सीआरएम 2011 देर से बाध्य डब्ल्यूसीएफ संगठन सेवा को कॉल करना संभव है - सीधे अनुकूलित बाध्यकारी?

कारण यह है कि मैं ऐसा कर रहा हूं कि मैं इस परिदृश्य को बाद में बिज़टॉक पर पोर्ट करना चाहता हूं।

मैंने सफलतापूर्वक एसवीसीयूटीटी के साथ प्रॉक्सी कक्षाएं उत्पन्न की हैं, लेकिन नीतियों और सुरक्षा अनुमानों का हिस्सा कॉन्फ़िगरेशन स्कीमा के साथ संगत नहीं है। SvcUtil के बजाय कोड से बाध्यकारी बनाने का सुझाव देता है, जो मैं करने की कोशिश कर रहा हूं।

जिसके परिणामस्वरूप कोड यहाँ है:

 private static void CallWcf() 
    { 
     OrganizationServiceClient client = null; 

     try 
     { 
      // Login Live.com Issuer Binding 

      var wsHttpBinding = new WSHttpBinding(); 
      wsHttpBinding.Security = new WSHttpSecurity(); 
      wsHttpBinding.Security.Mode = SecurityMode.Transport; 

      // Endpoint Binding Elements 

      var securityElement = new TransportSecurityBindingElement(); 
      securityElement.DefaultAlgorithmSuite = SecurityAlgorithmSuite.TripleDes; 
      securityElement.IncludeTimestamp = true; 
      securityElement.KeyEntropyMode = SecurityKeyEntropyMode.CombinedEntropy; 
      securityElement.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10; 
      securityElement.SecurityHeaderLayout = SecurityHeaderLayout.Strict; 

      var securityTokenParameters = new IssuedSecurityTokenParameters(); 
      securityTokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToRecipient; 
      securityTokenParameters.ReferenceStyle = SecurityTokenReferenceStyle.Internal; 
      securityTokenParameters.RequireDerivedKeys = false; 
      securityTokenParameters.TokenType = null; 
      securityTokenParameters.KeyType = SecurityKeyType.SymmetricKey; 
      securityTokenParameters.KeySize = 192; 
      securityTokenParameters.IssuerAddress = new EndpointAddress("https://login.live.com/extSTS.srf"); 
      securityTokenParameters.IssuerMetadataAddress = null; 
      securityTokenParameters.DefaultMessageSecurityVersion = null; 
      securityTokenParameters.IssuerBinding = wsHttpBinding; 

      securityElement.EndpointSupportingTokenParameters.Signed.Add(securityTokenParameters); 

      var textMessageEncodingElement = new TextMessageEncodingBindingElement(); 
      textMessageEncodingElement.MaxReadPoolSize = 64; 
      textMessageEncodingElement.MaxWritePoolSize = 16; 
      textMessageEncodingElement.MessageVersion = MessageVersion.Default; 
      textMessageEncodingElement.WriteEncoding = System.Text.Encoding.UTF8; 

      textMessageEncodingElement.ReaderQuotas.MaxStringContentLength = 8192; 
      textMessageEncodingElement.ReaderQuotas.MaxArrayLength = 16384; 
      textMessageEncodingElement.ReaderQuotas.MaxBytesPerRead = 4096; 
      textMessageEncodingElement.ReaderQuotas.MaxNameTableCharCount = 16384; 

      var httpsTransportElement = new HttpsTransportBindingElement(); 
      httpsTransportElement.ManualAddressing = false; 
      httpsTransportElement.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous; 

      CustomBinding binding = new CustomBinding(); 
      binding.Elements.Add(securityElement); 
      binding.Elements.Add(textMessageEncodingElement); 
      binding.Elements.Add(httpsTransportElement); 

      client = new OrganizationServiceClient(binding, new EndpointAddress(EndpointUri)); 
      client.ClientCredentials.UserName.UserName = Username; 
      client.ClientCredentials.UserName.Password = Password; 
      client.Open(); 

      var columnSet = new schemas.microsoft.com.xrm._2011.Contracts.ColumnSet(); 
      var identifier = new Guid("fbf8240e-2c85-e011-ad55-1cc1de0878eb"); 

      columnSet.Columns = new string[] { "name" }; 
      var entity = client.Retrieve("account", identifier, columnSet); 
     } 

     finally 
     { 
      if (client != null) 
       client.Close(); 
     } 
    } 

मैं फ़ेडरेटेड प्रमाणीकरण करने के लिए नए कर रहा हूँ और एक कठिन समय कई उपलब्ध बाइंडिंग के बीच संभावित मतभेद पता लगाना हो रहा है, तो मैं किसी भी मदद के लिए आभारी होंगे इस संबंध में।

+1

क्या आपने कभी यह पाया है कि यह कैसे करें? – cheeesus

+0

और, एसडीके सहायक वर्ग का क्या मतलब है? – cheeesus

+1

मैंने इसका पीछा नहीं किया और कभी नहीं पता चला। जिसे मैं एसडीके हेल्पर क्लासेस कहता हूं वह विभिन्न नमूने हैं जो सीआरएम 2011 एसडीके के साथ शिप करते हैं। –

उत्तर

2

यह संभवतः संभव है, लेकिन बेहद जटिल है। हमारे पास डायनेमिक्स का उपयोग करने वाला एक प्रोजेक्ट था जो एडीएफएस में चले गए, और रीफ्रेशिंग टोकन (कोड फॉर्म autorefreshsecuritytoken.cs, deviceidmanager.cs और एसडीके से toolserviceproxies.cs) के आसपास बहुत सारे अतिरिक्त कोड जोड़ने की आवश्यकता थी और वह अभी भी सब कुछ के लिए एसडीके का उपयोग कर रहा था।

ध्यान में रखें कि आपको विंडोज़ में भी पहचान की आवश्यकता है। ओएस में मान्यता स्थापित है जो कॉपी करने के लिए कार्यक्षमता का एक और भार है।

अंत में आप हमेशा JustDecompile का उपयोग कर सकते हैं या यह देखने के लिए कि एसडीके क्या कर रहा है।