Last modified by Nico Lemaire on 2025/05/06 15:49

From version 1.4
edited by Robin Huisman
on 2022/02/08 11:45
Change comment: There is no comment for this version
To version 1.3
edited by Roelof Zwaan
on 2021/11/23 11:40
Change comment: Update document after refactoring.

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.RobinHuisman
1 +XWiki.RoelofZwaan
Content
... ... @@ -91,56 +91,96 @@
91 91  |9|Go back to step 5, for every Customer code, every language.| | | | |
92 92  |10|Process the LabDeliveryFiles| | | | |
93 93  
94 +
94 94  == Get Customers (POST) ==
95 95  
96 96  === Request example ===
97 97  
98 98  |(((
99 -{{code language="C#"}}
100 100  public GetCustomersCall.Response GetCustomers(string WebserviceUsername, string WebservicePassword, string CustomerUsername)
101 -        {
102 -            GetCustomersCall.Response set = new GetCustomersCall.Response();
103 103  
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 -                });
102 + {
112 112  
113 -                HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result;
114 -                response.EnsureSuccessStatusCode();
115 -                string responseMessage = response.Content.ReadAsStringAsync().Result;
104 + GetCustomersCall.Response set = new GetCustomersCall.Response();
116 116  
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}}
142 142  
143 -
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 + }
144 144  )))
145 145  
146 146  |(((
... ... @@ -184,6 +184,7 @@
184 184  </Response>
185 185  )))
186 186  
227 +
187 187  == Get Products (POST) ==
188 188  
189 189  === Request example ===
... ... @@ -346,6 +346,7 @@
346 346  )))
347 347  
348 348  
390 +
349 349  = Gebruikersaccount controleren. =
350 350  
351 351  
... ... @@ -910,6 +910,7 @@
910 910  )))
911 911  
912 912  
955 +
913 913  = Get Order status and Results =
914 914  
915 915  == Oplossing/Design ==
... ... @@ -1079,3 +1079,5 @@
1079 1079  
1080 1080  
1081 1081  
1125 +
1126 +