Produced by Araxis Merge on 2/1/2017 2:56:29 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\Client\SOAPLogger\SOAPLogger | SOAPLogger.cs | Tue Dec 20 19:51:45 2016 UTC |
| 2 | Wed Feb 1 19:56:29 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 168 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 2 | // This f ile is par t of the M icrosoft D ynamics CR M SDK code samples. | |||||
| 3 | // | |||||
| 4 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 5 | // | |||||
| 6 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 7 | // Develo pment Tool s and/or o n-line doc umentation . See the se other | |||||
| 8 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 9 | // | |||||
| 10 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 11 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 12 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 13 | // PARTIC ULAR PURPO SE. | |||||
| 14 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 15 | ||||||
| 16 | //<snippet SOAPLogger > | |||||
| 17 | using Syst em; | |||||
| 18 | using Syst em.Service Model; | |||||
| 19 | using Syst em.Service Model.Desc ription; | |||||
| 20 | using Syst em.IO; | |||||
| 21 | ||||||
| 22 | // These n amespaces are found in the Mic rosoft.Xrm .Sdk.dll a ssembly | |||||
| 23 | // located in the SD K\bin fold er of the SDK downlo ad. | |||||
| 24 | using Micr osoft.Xrm. Sdk; | |||||
| 25 | using Micr osoft.Xrm. Sdk.Query; | |||||
| 26 | using Micr osoft.Xrm. Sdk.Client ; | |||||
| 27 | using Micr osoft.Crm. Sdk.Messag es; | |||||
| 28 | using Micr osoft.Xrm. Sdk.Messag es; | |||||
| 29 | using Micr osoft.Xrm. Sdk.Metada ta; | |||||
| 30 | ||||||
| 31 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 32 | { | |||||
| 33 | /// <summ ary> | |||||
| 34 | /// Use t his projec t to captu re the SOA P Requests and Respo nses for c ode in the Run metho d.</summar y> | |||||
| 35 | /// <rema rks> | |||||
| 36 | /// When run this p roject in Visual Stu dio the SO AP message s will be written to a file. < /remarks> | |||||
| 37 | public cl ass SOAPLo gger | |||||
| 38 | { | |||||
| 39 | #region Class Leve l Members | |||||
| 40 | ||||||
| 41 | private Organizati onServiceP roxy _serv iceProxy; | |||||
| 42 | ||||||
| 43 | #endregi on Class L evel Membe rs | |||||
| 44 | ||||||
| 45 | #region CodeToCapt ure | |||||
| 46 | /// <sum mary> | |||||
| 47 | /// This method co nnects to the Organi zation ser vice. | |||||
| 48 | /// </su mmary> | |||||
| 49 | /// <par am name="s erverConfi g">Contain s server c onnection informatio n.</param> | |||||
| 50 | //<snipp etSOAPLogg er1> | |||||
| 51 | public v oid Run(Se rverConnec tion.Confi guration s erverConfi g) | |||||
| 52 | { | |||||
| 53 | try | |||||
| 54 | { | |||||
| 55 | ||||||
| 56 | // Con nect to th e Organiza tion servi ce. | |||||
| 57 | // The using sta tement ass ures that the servic e proxy wi ll be prop erly dispo sed. | |||||
| 58 | usi ng (_servi ceProxy = new Organi zationServ iceProxy(s erverConfi g.Organiza tionUri, s erverConfi g.HomeReal mUri, serv erConfig.C redentials , serverCo nfig.Devic eCredentia ls)) | |||||
| 59 | { | |||||
| 60 | // Th is stateme nt is requ ired to en able early -bound typ e support. | |||||
| 61 | _serv iceProxy.E nableProxy Types(); | |||||
| 62 | ||||||
| 63 | IOrga nizationSe rvice serv ice = (IOr ganization Service)_s erviceProx y; | |||||
| 64 | ||||||
| 65 | ||||||
| 66 | using (StreamWr iter outpu t = new St reamWriter ("output.t xt")) | |||||
| 67 | { | |||||
| 68 | ||||||
| 69 | Soap LoggerOrga nizationSe rvice slos = new Soa pLoggerOrg anizationS ervice(ser verConfig. Organizati onUri, ser vice, outp ut); | |||||
| 70 | ||||||
| 71 | //Ad d the code you want to test he re: | |||||
| 72 | // Y ou must us e the Soap LoggerOrga nizationSe rvice 'slo s' proxy r ather than the IOrga nizationSe rvice prox y you woul d normally use. | |||||
| 73 | ||||||
| 74 | ||||||
| 75 | ||||||
| 76 | } | |||||
| 77 | ||||||
| 78 | ||||||
| 79 | } | |||||
| 80 | ||||||
| 81 | } | |||||
| 82 | ||||||
| 83 | // Catc h any serv ice fault exceptions that Micr osoft Dyna mics CRM t hrows. | |||||
| 84 | catch ( FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault>) | |||||
| 85 | { | |||||
| 86 | // You can handl e an excep tion here or pass it back to t he calling method. | |||||
| 87 | throw; | |||||
| 88 | } | |||||
| 89 | } | |||||
| 90 | //</snip petSOAPLog ger1> | |||||
| 91 | ||||||
| 92 | ||||||
| 93 | #endregi on CodeToC apture | |||||
| 94 | ||||||
| 95 | #region Main metho d | |||||
| 96 | ||||||
| 97 | /// <sum mary> | |||||
| 98 | /// Base d on the M ain() meth od used by most SDK samples. | |||||
| 99 | /// </su mmary> | |||||
| 100 | /// <par am name="a rgs"></par am> | |||||
| 101 | static p ublic void Main(stri ng[] args) | |||||
| 102 | { | |||||
| 103 | try | |||||
| 104 | { | |||||
| 105 | // Obt ain the ta rget organ ization's Web addres s and clie nt logon | |||||
| 106 | // cre dentials f rom the us er. | |||||
| 107 | Server Connection serverCon nect = new ServerCon nection(); | |||||
| 108 | Server Connection .Configura tion confi g = server Connect.Ge tServerCon figuration (); | |||||
| 109 | ||||||
| 110 | SOAPLo gger app = new SOAPL ogger(); | |||||
| 111 | app.Ru n(config); | |||||
| 112 | } | |||||
| 113 | ||||||
| 114 | catch ( FaultExcep tion<Micro soft.Xrm.S dk.Organiz ationServi ceFault> e x) | |||||
| 115 | { | |||||
| 116 | Consol e.WriteLin e("The app lication t erminated with an er ror."); | |||||
| 117 | Consol e.WriteLin e("Timesta mp: {0}", ex.Detail. Timestamp) ; | |||||
| 118 | Consol e.WriteLin e("Code: { 0}", ex.De tail.Error Code); | |||||
| 119 | Consol e.WriteLin e("Message : {0}", ex .Detail.Me ssage); | |||||
| 120 | Consol e.WriteLin e("Trace: {0}", ex.D etail.Trac eText); | |||||
| 121 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 122 | nu ll == ex.D etail.Inne rFault ? " No Inner F ault" : "H as Inner F ault"); | |||||
| 123 | } | |||||
| 124 | catch ( System.Tim eoutExcept ion ex) | |||||
| 125 | { | |||||
| 126 | Consol e.WriteLin e("The app lication t erminated with an er ror."); | |||||
| 127 | Consol e.WriteLin e("Message : {0}", ex .Message); | |||||
| 128 | Consol e.WriteLin e("Stack T race: {0}" , ex.Stack Trace); | |||||
| 129 | Consol e.WriteLin e("Inner F ault: {0}" , | |||||
| 130 | nu ll == ex.I nnerExcept ion.Messag e ? "No In ner Fault" : ex.Inne rException .Message); | |||||
| 131 | } | |||||
| 132 | catch ( System.Exc eption ex) | |||||
| 133 | { | |||||
| 134 | Consol e.WriteLin e("The app lication t erminated with an er ror."); | |||||
| 135 | Consol e.WriteLin e(ex.Messa ge); | |||||
| 136 | ||||||
| 137 | // Dis play the d etails of the inner exception. | |||||
| 138 | if (ex .InnerExce ption != n ull) | |||||
| 139 | { | |||||
| 140 | Conso le.WriteLi ne(ex.Inne rException .Message); | |||||
| 141 | ||||||
| 142 | Fault Exception< Microsoft. Xrm.Sdk.Or ganization ServiceFau lt> fe = e x.InnerExc eption | |||||
| 143 | a s FaultExc eption<Mic rosoft.Xrm .Sdk.Organ izationSer viceFault> ; | |||||
| 144 | if (f e != null) | |||||
| 145 | { | |||||
| 146 | Cons ole.WriteL ine("Times tamp: {0}" , fe.Detai l.Timestam p); | |||||
| 147 | Cons ole.WriteL ine("Code: {0}", fe. Detail.Err orCode); | |||||
| 148 | Cons ole.WriteL ine("Messa ge: {0}", fe.Detail. Message); | |||||
| 149 | Cons ole.WriteL ine("Trace : {0}", fe .Detail.Tr aceText); | |||||
| 150 | Cons ole.WriteL ine("Inner Fault: {0 }", | |||||
| 151 | null == fe .Detail.In nerFault ? "No Inner Fault" : "Has Inner Fault"); | |||||
| 152 | } | |||||
| 153 | } | |||||
| 154 | } | |||||
| 155 | ||||||
| 156 | // Addi tional exc eptions to catch: Se curityToke nValidatio nException , ExpiredS ecurityTok enExceptio n, | |||||
| 157 | // Secu rityAccess DeniedExce ption, Mes sageSecuri tyExceptio n, and Sec urityNegot iationExce ption. | |||||
| 158 | ||||||
| 159 | finally | |||||
| 160 | { | |||||
| 161 | Consol e.WriteLin e("Press < Enter> to exit."); | |||||
| 162 | Consol e.ReadLine (); | |||||
| 163 | } | |||||
| 164 | } | |||||
| 165 | #endregi on Main me thod | |||||
| 166 | } | |||||
| 167 | } | |||||
| 168 | //</snippe tSOAPLogge r> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.