Last modified by Nico Lemaire on 2025/05/06 15:49
From version 1.3
edited by Roelof Zwaan
on 2021/11/23 11:40
on 2021/11/23 11:40
Change comment:
Update document after refactoring.
To version 3.1
edited by Robin Huisman
on 2022/02/08 11:50
on 2022/02/08 11:50
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.Ro elofZwaan1 +XWiki.RobinHuisman - Content
-
... ... @@ -91,96 +91,56 @@ 91 91 |9|Go back to step 5, for every Customer code, every language.| | | | | 92 92 |10|Process the LabDeliveryFiles| | | | | 93 93 94 - 95 95 == Get Customers (POST) == 96 96 97 97 === Request example === 98 98 99 99 |((( 99 +{{code language="C#"}} 100 100 public GetCustomersCall.Response GetCustomers(string WebserviceUsername, string WebservicePassword, string CustomerUsername) 101 + { 102 + GetCustomersCall.Response set = new GetCustomersCall.Response(); 101 101 102 - { 104 + try 105 + { 106 + var content = new FormUrlEncodedContent(new[] 107 + { 108 + new KeyValuePair<string, string>("userName", WebserviceUsername), 109 + new KeyValuePair<string, string>("password", WebservicePassword), 110 + new KeyValuePair<string, string>("customerUsername", CustomerUsername), 111 + }); 103 103 104 - GetCustomersCall.Response set = new GetCustomersCall.Response(); 113 + HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result; 114 + response.EnsureSuccessStatusCode(); 115 + string responseMessage = response.Content.ReadAsStringAsync().Result; 105 105 117 + if (string.IsNullOrEmpty(responseMessage)) 118 + { 119 + throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / GetCustomers" + "]"); 120 + } 121 + using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage))) 122 + { 123 + XmlSerializer serializer = new XmlSerializer(typeof(GetCustomersCall.Response)); 124 + set = (GetCustomersCall.Response)serializer.Deserialize(ms); 125 + } 126 + } 127 + catch (Exception ex) 128 + { 129 + #region handle exception 130 + set.Status = new BusinessEntities.LabRestService.GetCustomersCall.ResponseStatus(); 131 + set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString(); 132 + set.Status.ErrorMessage = "Exception occurred in GetCustomers (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message; 133 + ex.Data.Add("WebserviceUsername", WebserviceUsername); 134 + ex.Data.Add("WebservicePassword", WebservicePassword); 135 + ex.Data.Add("CustomerUsername", CustomerUsername); 136 + ExceptionHandler.HandleException(ex); 137 + #endregion 138 + } 139 + return set; 140 + } 141 +{{/code}} 106 106 107 - try 108 - 109 - { 110 - 111 - 112 - var content = new FormUrlEncodedContent(new[] 113 - 114 - { 115 - 116 - new KeyValuePair<string, string>("userName", WebserviceUsername), 117 - 118 - new KeyValuePair<string, string>("password", WebservicePassword), 119 - 120 - new KeyValuePair<string, string>("customerUsername", CustomerUsername), 121 - 122 - }); 123 - 124 - 125 - HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result; 126 - 127 - response.EnsureSuccessStatusCode(); 128 - 129 - string responseMessage = response.Content.ReadAsStringAsync().Result; 130 - 131 - 132 - if (string.IsNullOrEmpty(responseMessage)) 133 - 134 - { 135 - 136 - throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / GetCustomers" + "]"); 137 - 138 - } 139 - 140 - using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~) 141 - 142 - { 143 - 144 - XmlSerializer serializer = new XmlSerializer(typeof(GetCustomersCall.Response)); 145 - 146 - set = (GetCustomersCall.Response)serializer.Deserialize(ms); 147 - 148 - } 149 - 150 - 151 - } 152 - 153 - catch (Exception ex) 154 - 155 - { 156 - 157 - #region handle exception 158 - 159 - 160 - set.Status = new BusinessEntities.LabRestService.GetCustomersCall.ResponseStatus(); 161 - 162 - set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString(); 163 - 164 - set.Status.ErrorMessage = "Exception occurred in GetCustomers (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message; 165 - 166 - 167 - ex.Data.Add("WebserviceUsername", WebserviceUsername); 168 - 169 - ex.Data.Add("WebservicePassword", WebservicePassword); 170 - 171 - ex.Data.Add("CustomerUsername", CustomerUsername); 172 - 173 - 174 - ExceptionHandler.HandleException(ex); 175 - 176 - #endregion 177 - 178 - } 179 - 180 - 181 - return set; 182 - 183 - } 143 + 184 184 ))) 185 185 186 186 |((( ... ... @@ -201,30 +201,23 @@ 201 201 === Response example === 202 202 203 203 |((( 164 +{{code language="XML"}} 204 204 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 205 - 206 206 <Response><Customers> 207 - 208 - <Customer LabId="1" LabName="Example Laboratorium" CustomerId="300" CustomerName="Adviesbureau De bodemkoning - Rotterdam" LastModifiedOnClient="2019-05-08T11:05:14.17+02:00" /> 209 - 210 - <Customer LabId="1" LabName="Example Laboratorium" CustomerId="656" CustomerName="Adviesbureau De bodemkoning - Delft" LastModifiedOnClient="2019-04-19T13:20:10.123+02:00" /> 211 - 167 + <Customer LabId="1" LabName="Example Laboratorium" CustomerId="300" CustomerName="Adviesbureau De bodemkoning - Rotterdam" LastModifiedOnClient="2019-05-08T11:05:14.17+02:00" /> 168 + <Customer LabId="1" LabName="Example Laboratorium" CustomerId="656" CustomerName="Adviesbureau De bodemkoning - Delft" LastModifiedOnClient="2019-04-19T13:20:10.123+02:00" /> 212 212 </Customers> 213 - 214 214 <Status> 215 - 216 - <StatusCode>1</StatusCode> 217 - 218 - <StatusCodeDescription>OK</StatusCodeDescription> 219 - 220 - <ErrorMessage></ErrorMessage> 221 - 171 + <StatusCode>1</StatusCode> 172 + <StatusCodeDescription>OK</StatusCodeDescription> 173 + <ErrorMessage></ErrorMessage> 222 222 </Status> 223 - 224 224 </Response> 176 +{{/code}} 177 + 178 + 225 225 ))) 226 226 227 - 228 228 == Get Products (POST) == 229 229 230 230 === Request example === ... ... @@ -386,8 +386,6 @@ 386 386 </Status></Response> 387 387 ))) 388 388 389 - 390 - 391 391 = Gebruikersaccount controleren. = 392 392 393 393 ... ... @@ -951,8 +951,6 @@ 951 951 </Status></Response> 952 952 ))) 953 953 954 - 955 - 956 956 = Get Order status and Results = 957 957 958 958 == Oplossing/Design == ... ... @@ -1121,6 +1121,3 @@ 1121 1121 1122 1122 1123 1123 1124 - 1125 - 1126 -