Produced by Araxis Merge on 2/1/2017 2:56:50 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\ModernAndMobileApps\ModernSoapApp | RequestBuilder.cs | Tue Dec 20 19:51:47 2016 UTC |
| 2 | Wed Feb 1 19:56:50 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 88 |
| 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 | // | |||||
| 3 | // This f ile is par t of the M icrosoft D ynamics CR M SDK Code Samples. | |||||
| 4 | // | |||||
| 5 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 6 | // | |||||
| 7 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 8 | // Develo pment Tool s and/or o nline docu mentation. See thes e other | |||||
| 9 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 10 | // | |||||
| 11 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 12 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 13 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 14 | // PARTIC ULAR PURPO SE. | |||||
| 15 | // | |||||
| 16 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 17 | ||||||
| 18 | //<snippet ModernSoap App2> | |||||
| 19 | using Syst em.Net.Htt p; | |||||
| 20 | using Syst em.Net.Htt p.Headers; | |||||
| 21 | using Syst em.Threadi ng.Tasks; | |||||
| 22 | ||||||
| 23 | namespace ModernSoap App | |||||
| 24 | { | |||||
| 25 | public static cl ass HttpRe questBuild er | |||||
| 26 | { | |||||
| 27 | // / <summary > | |||||
| 28 | // / Retrieve entity re cord data from the o rganizatio n web serv ice. | |||||
| 29 | // / </summar y> | |||||
| 30 | // / <param n ame="acces sToken">Th e web serv ice authen tication a ccess toke n.</param> | |||||
| 31 | // / <param n ame="Colum ns">The en tity attri butes to r etrieve.</ param> | |||||
| 32 | // / <param n ame="entit y">The tar get entity for which the data should be retreived. </param> | |||||
| 33 | // / <returns >Response from the w eb service .</returns > | |||||
| 34 | // / <remarks >Builds a SOAP HTTP request us ing passed parameter s and send s the requ est to the server.</ remarks> | |||||
| 35 | pu blic stati c async Ta sk<string> RetrieveM ultiple(st ring acces sToken, st ring[] Col umns, stri ng entity) | |||||
| 36 | { | |||||
| 37 | // Build a list of entity at tributes t o retrieve as a stri ng. | |||||
| 38 | string c olumnsSet = string.E mpty; | |||||
| 39 | foreach (string Co lumn in Co lumns) | |||||
| 40 | { | |||||
| 41 | colu mnsSet += "<b:string >" + Colum n + "</b:s tring>"; | |||||
| 42 | } | |||||
| 43 | ||||||
| 44 | // Defau lt SOAP en velope str ing. This XML code w as obtaine d using th e SOAPLogg er tool. | |||||
| 45 | string x mlSOAP = | |||||
| 46 | @"<s:En velope xml ns:s='http ://schemas .xmlsoap.o rg/soap/en velope/'> | |||||
| 47 | <s:B ody> | |||||
| 48 | <R etrieveMul tiple xmln s='http:// schemas.mi crosoft.co m/xrm/2011 /Contracts /Services' xmlns:i=' http://www .w3.org/20 01/XMLSche ma-instanc e'> | |||||
| 49 | <query i:t ype='a:Que ryExpressi on' xmlns: a='http:// schemas.mi crosoft.co m/xrm/2011 /Contracts '><a:Colum nSet> | |||||
| 50 | <a:AllColu mns>false< /a:AllColu mns><a:Col umns xmlns :b='http:/ /schemas.m icrosoft.c om/2003/10 /Serializa tion/Array s'>" + col umnsSet + | |||||
| 51 | @ "</a:Colum ns></a:Col umnSet><a: Criteria>< a:Conditio ns /><a:Fi lterOperat or>And</a: FilterOper ator><a:Fi lters /></ a:Criteria > | |||||
| 52 | <a:Distinc t>false</a :Distinct> <a:EntityN ame>" + en tity + @"< /a:EntityN ame><a:Lin kEntities /><a:Order s /> | |||||
| 53 | <a:PageInf o><a:Count >0</a:Coun t><a:PageN umber>0</a :PageNumbe r><a:Pagin gCookie i: nil='true' /> | |||||
| 54 | <a:ReturnT otalRecord Count>fals e</a:Retur nTotalReco rdCount> | |||||
| 55 | </a:PageIn fo><a:NoLo ck>false</ a:NoLock>< /query> | |||||
| 56 | </ RetrieveMu ltiple> | |||||
| 57 | </s: Body> | |||||
| 58 | </s:En velope>"; | |||||
| 59 | ||||||
| 60 | // The U RL for the SOAP endp oint of th e organiza tion web s ervice. | |||||
| 61 | string u rl = Curre ntEnvironm ent.CrmSer viceUrl + "/XRMServi ces/2011/O rganizatio n.svc/web" ; | |||||
| 62 | ||||||
| 63 | // Use t he Retriev eMultiple CRM messag e as the S OAP action . | |||||
| 64 | string S OAPAction = "http:// schemas.mi crosoft.co m/xrm/2011 /Contracts /Services/ IOrganizat ionService /RetrieveM ultiple"; | |||||
| 65 | ||||||
| 66 | // Creat e a new HT TP request . | |||||
| 67 | HttpClie nt httpCli ent = new HttpClient (); | |||||
| 68 | ||||||
| 69 | // Set t he HTTP au thorizatio n header u sing the a ccess toke n. | |||||
| 70 | httpClie nt.Default RequestHea ders.Autho rization = new Authe nticationH eaderValue ("Bearer", accessTok en); | |||||
| 71 | ||||||
| 72 | // Finis h setting up the HTT P request. | |||||
| 73 | HttpRequ estMessage req = new HttpReque stMessage( HttpMethod .Post, url ); | |||||
| 74 | req.Head ers.Add("S OAPAction" , SOAPActi on); | |||||
| 75 | req.Meth od = HttpM ethod.Post ; | |||||
| 76 | req.Cont ent = new StringCont ent(xmlSOA P); | |||||
| 77 | req.Cont ent.Header s.ContentT ype = Medi aTypeHeade rValue.Par se("text/x ml; charse t=utf-8"); | |||||
| 78 | ||||||
| 79 | // Send the reques t asychron ously and wait for t he respons e. | |||||
| 80 | HttpResp onseMessag e response ; | |||||
| 81 | response = await h ttpClient. SendAsync( req); | |||||
| 82 | var resp onseBodyAs Text = awa it respons e.Content. ReadAsStri ngAsync(); | |||||
| 83 | ||||||
| 84 | return r esponseBod yAsText; | |||||
| 85 | } | |||||
| 86 | } | |||||
| 87 | } | |||||
| 88 | //</snippe tModernSoa pApp2> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.