/// <summary> /// <see cref="Sif.Framework.Consumer.IGenericConsumer{T,PK}.Update(T)">Update</see> /// </summary> public virtual void Update(T obj) { if (!registrationService.Registered) { throw new InvalidOperationException("Consumer has not registered."); } string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s" + "/" + obj.Id; string body = ObjectSerialiser.Serialise(obj); string xml = HttpUtils.PutRequest(url, registrationService.AuthorisationToken, body); if (log.IsDebugEnabled) { log.Debug("XML from PUT request ..."); } if (log.IsDebugEnabled) { log.Debug(xml); } }
/// <summary> /// <see cref="Sif.Framework.Consumer.IGenericConsumer{T,PK}.Retrieve(T)">Retrieve</see> /// </summary> public virtual ICollection <T> Retrieve(T obj) { if (!registrationService.Registered) { throw new InvalidOperationException("Consumer has not registered."); } string url = EnvironmentUtils.ParseServiceUrl(environmentTemplate) + "/" + TypeName + "s"; string body = ObjectSerialiser.Serialise(obj); string xml = HttpUtils.PostRequest(url, registrationService.AuthorisationToken, body, "GET"); if (log.IsDebugEnabled) { log.Debug("XML from POST request ..."); } if (log.IsDebugEnabled) { log.Debug(xml); } return(ListSerialiser.Deserialise(xml)); }