Example #1
0
        /// <inheritdoc cref="ITriasHttpClient"/>
        public async Task <TType> BaseTriasCall <TType>(object requestPayload)
        {
            var serviceRequest = new ServiceRequestStructure1
            {
                RequestTimestamp = System.DateTime.Now,
                RequestorRef     = new ParticipantRefStructure {
                    Value = "OpenService"
                },
                RequestPayload = new RequestPayloadStructure {
                    Item = requestPayload
                }
            };
            var trias = new Trias {
                Item = serviceRequest
            };
            var text = XmlSerialisation(trias);

            await WaitUntilReadyForConnection().ConfigureAwait(false);

            _currentOpenConnections++;
            HttpResponseMessage?response = null;

            try
            {
                response = await TriasRequestClientHandling(text).ConfigureAwait(false);

                OnRequestFinished(response);
                await EnsureSuccessTriasResponse(response).ConfigureAwait(false);
            }
            finally
            {
                _currentOpenConnections--;
            }
            await using var responseStream = await response.Content !.ReadAsStreamAsync().ConfigureAwait(false);
            var responseTrias   = XmlDeserialization <Trias>(responseStream);
            var serviceDelivery = (ServiceDeliveryStructure1)responseTrias.Item;
            DeliveryPayloadStructure deliveryPayload = serviceDelivery.DeliveryPayload;

            return((TType)deliveryPayload.Item);
        }
Example #2
0
        public void TestTriasStructure()
        {
            var trias = new Trias();

            TestClass(trias, "");
        }