Skip to content

Commit 462c5a0

Browse files
committed
Ensure that the serviceType header is set to FUNCTIONAL for Functional Service calls.
1 parent b76e9a1 commit 462c5a0

14 files changed

Lines changed: 179 additions & 103 deletions

File tree

Code/Sif3Framework/Sif.Framework/Consumers/Consumer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public virtual TMultiple Query(uint? navigationPage = null, uint? navigationPage
281281

282282
if (navigationPage.HasValue && navigationPageSize.HasValue)
283283
{
284-
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, (int)navigationPage, (int)navigationPageSize);
284+
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, navigationPage: (int)navigationPage, navigationPageSize: (int)navigationPageSize);
285285
}
286286
else
287287
{
@@ -305,7 +305,7 @@ public virtual TMultiple QueryByExample(TSingle obj, uint? navigationPage = null
305305
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
306306
string body = SerialiseSingle(obj);
307307
// TODO: Update PostRequest to accept paging parameters.
308-
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
308+
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, methodOverride: "GET");
309309
if (log.IsDebugEnabled) log.Debug("XML from POST (Query by Example) request ...");
310310
if (log.IsDebugEnabled) log.Debug(xml);
311311

@@ -341,7 +341,7 @@ public virtual TMultiple QueryByServicePath(IEnumerable<EqualCondition> conditio
341341

342342
if (navigationPage.HasValue && navigationPageSize.HasValue)
343343
{
344-
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, (int)navigationPage, (int)navigationPageSize);
344+
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, navigationPage: (int)navigationPage, navigationPageSize: (int)navigationPageSize);
345345
}
346346
else
347347
{
@@ -460,7 +460,7 @@ public virtual MultipleDeleteResponse Delete(IEnumerable<TPrimaryKey> refIds, st
460460
deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
461461
string url = EnvironmentUtils.ParseServiceUrl(EnvironmentTemplate) + "/" + TypeName + "s" + HttpUtils.MatrixParameters(zoneId, contextId);
462462
string body = SerialiserFactory.GetXmlSerialiser<deleteRequestType>().Serialise(request);
463-
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
463+
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, methodOverride: "DELETE");
464464
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");
465465
if (log.IsDebugEnabled) log.Debug(xml);
466466
deleteResponseType updateResponseType = SerialiserFactory.GetXmlSerialiser<deleteResponseType>().Deserialise(xml);

Code/Sif3Framework/Sif.Framework/Consumers/FunctionalServiceConsumer.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public virtual Job Create(Job job, string zoneId = null, string contextId = null
183183

184184
string url = GetURLPrefix(job.Name) + "/" + job.Name + HttpUtils.MatrixParameters(zoneId, contextId);
185185
string body = SerialiseSingle<Job, jobType>(job);
186-
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
186+
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL);
187187
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
188188
if (log.IsDebugEnabled) log.Debug(xml);
189189

@@ -205,7 +205,7 @@ public virtual MultipleCreateResponse Create(List<Job> jobs, string zoneId = nul
205205

206206
string url = GetURLPrefix(jobName) + HttpUtils.MatrixParameters(zoneId, contextId);
207207
string body = SerialiseMultiple(jobs);
208-
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
208+
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL);
209209
if (log.IsDebugEnabled) log.Debug("XML from POST request ...");
210210
if (log.IsDebugEnabled) log.Debug(xml);
211211
createResponseType createResponseType = SerialiserFactory.GetXmlSerialiser<createResponseType>().Deserialise(xml);
@@ -240,7 +240,7 @@ where s.StatusCode.StartsWith("2")
240240

241241
foreach(Job job in toFetch)
242242
{
243-
fetched.Add(this.Query(job, zoneId, contextId));
243+
fetched.Add(Query(job, zoneId, contextId));
244244
}
245245

246246
return fetched;
@@ -262,7 +262,7 @@ public virtual Job Query(Job job, string zoneId = null, string contextId = null)
262262
try
263263
{
264264
string url = GetURLPrefix(job.Name) + "/" + job.Id + HttpUtils.MatrixParameters(zoneId, contextId);
265-
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
265+
string xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, ServiceType.FUNCTIONAL);
266266
if (log.IsDebugEnabled) log.Debug("XML from GET request ...");
267267
if (log.IsDebugEnabled) log.Debug(xml);
268268
return DeserialiseSingle<Job, jobType>(xml);
@@ -310,11 +310,11 @@ public virtual List<Job> Query(string jobName, uint? navigationPage = null, uint
310310

311311
if (navigationPage.HasValue && navigationPageSize.HasValue)
312312
{
313-
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, (int)navigationPage, (int)navigationPageSize);
313+
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, ServiceType.FUNCTIONAL, (int)navigationPage, (int)navigationPageSize);
314314
}
315315
else
316316
{
317-
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken);
317+
xml = HttpUtils.GetRequest(url, RegistrationService.AuthorisationToken, ServiceType.FUNCTIONAL);
318318
}
319319

320320
return DeserialiseMultiple<Job, jobType>(xml);
@@ -338,7 +338,7 @@ public virtual List<Job> QueryByExample(Job job, uint? navigationPage = null, ui
338338
string url = GetURLPrefix(job.Name) + HttpUtils.MatrixParameters(zoneId, contextId);
339339
string body = SerialiseSingle<Job, jobType>(job);
340340
// TODO: Update PostRequest to accept paging parameters.
341-
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET");
341+
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, "GET");
342342
if (log.IsDebugEnabled) log.Debug("XML from POST (Query by Example) request ...");
343343
if (log.IsDebugEnabled) log.Debug(xml);
344344

@@ -389,7 +389,7 @@ public virtual void Delete(Job job, string zoneId = null, string contextId = nul
389389
checkJob(job, RightType.DELETE, zoneId);
390390

391391
string url = GetURLPrefix(job.Name) + "/" + job.Id + HttpUtils.MatrixParameters(zoneId, contextId);
392-
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken);
392+
string xml = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken, ServiceType.FUNCTIONAL);
393393
if (log.IsDebugEnabled) log.Debug("XML from DELETE request ...");
394394
if (log.IsDebugEnabled) log.Debug(xml);
395395
}
@@ -417,7 +417,7 @@ public virtual MultipleDeleteResponse Delete(List<Job> jobs, string zoneId = nul
417417
deleteRequestType request = new deleteRequestType { deletes = deleteIds.ToArray() };
418418
string url = GetURLPrefix(jobName) + HttpUtils.MatrixParameters(zoneId, contextId);
419419
string body = SerialiserFactory.GetXmlSerialiser<deleteRequestType>().Serialise(request);
420-
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, "DELETE");
420+
string xml = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, "DELETE");
421421
if (log.IsDebugEnabled) log.Debug("XML from PUT (DELETE) request ...");
422422
if (log.IsDebugEnabled) log.Debug(xml);
423423
deleteResponseType updateResponseType = SerialiserFactory.GetXmlSerialiser<deleteResponseType>().Deserialise(xml);
@@ -445,7 +445,7 @@ public virtual string CreateToPhase(Job job, string phaseName, string body = nul
445445

446446
string response = null;
447447
string url = GetURLPrefix(job.Name) + "/" + job.Id + "/" + phaseName + HttpUtils.MatrixParameters(zoneId, contextId);
448-
response = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, contentTypeOverride: contentTypeOverride, acceptOverride: acceptOverride);
448+
response = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, contentTypeOverride: contentTypeOverride, acceptOverride: acceptOverride);
449449
if (log.IsDebugEnabled) log.Debug("String from CREATE request to phase ...");
450450
if (log.IsDebugEnabled) log.Debug(response);
451451
return response;
@@ -470,7 +470,7 @@ public virtual string RetrieveToPhase(Job job, string phaseName, string body = n
470470

471471
string response = null;
472472
string url = GetURLPrefix(job.Name) + "/" + job.Id + "/" + phaseName + HttpUtils.MatrixParameters(zoneId, contextId);
473-
response = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, "GET", contentTypeOverride, acceptOverride);
473+
response = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, "GET", contentTypeOverride, acceptOverride);
474474
if (log.IsDebugEnabled) log.Debug("String from GET request to phase ...");
475475
if (log.IsDebugEnabled) log.Debug(response);
476476
return response;
@@ -495,7 +495,7 @@ public virtual string UpdateToPhase(Job job, string phaseName, string body, stri
495495

496496
string response = null;
497497
string url = GetURLPrefix(job.Name) + "/" + job.Id + "/" + phaseName + HttpUtils.MatrixParameters(zoneId, contextId);
498-
response = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, contentTypeOverride: contentTypeOverride, acceptOverride: acceptOverride);
498+
response = HttpUtils.PutRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, contentTypeOverride: contentTypeOverride, acceptOverride: acceptOverride);
499499
if (log.IsDebugEnabled) log.Debug("String from PUT request to phase ...");
500500
if (log.IsDebugEnabled) log.Debug(response);
501501
return response;
@@ -520,7 +520,7 @@ public virtual string DeleteToPhase(Job job, string phaseName, string body, stri
520520

521521
string response = null;
522522
string url = GetURLPrefix(job.Name) + "/" + job.Id + "/" + phaseName + HttpUtils.MatrixParameters(zoneId, contextId);
523-
response = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken, body, contentTypeOverride: contentTypeOverride, acceptOverride: acceptOverride);
523+
response = HttpUtils.DeleteRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL, contentTypeOverride, acceptOverride);
524524
if (log.IsDebugEnabled) log.Debug("String from DELETE request to phase ...");
525525
if (log.IsDebugEnabled) log.Debug(response);
526526
return response;
@@ -543,7 +543,7 @@ public virtual PhaseState CreateToState(Job job, string phaseName, PhaseState it
543543

544544
string url = GetURLPrefix(job.Name) + "/" + job.Id + "/" + phaseName + "/states/state" + HttpUtils.MatrixParameters(zoneId, contextId);
545545
string body = SerialiseSingle<PhaseState, stateType>(item);
546-
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body);
546+
string xml = HttpUtils.PostRequest(url, RegistrationService.AuthorisationToken, body, ServiceType.FUNCTIONAL);
547547
if (log.IsDebugEnabled) log.Debug("Guid from CREATE request to state on phase ...");
548548
if (log.IsDebugEnabled) log.Debug(xml);
549549
return DeserialiseSingle<PhaseState, stateType>(xml);

0 commit comments

Comments
 (0)