示例#1
0
        protected string Post <TRequest>(TRequest request)
            where TRequest : APIRequestBodyBase <TRequest>
        {
            var result = _handler.Handle(() =>
            {
                return(_restfulClient.DoPost(request.Url,
                                             request.ContentType,
                                             request.Headers,
                                             request.ToString(),
                                             request.SecurityProtocol,
                                             request.TimeOut,
                                             request.UseSecurity));
            });

            return(result);
        }
示例#2
0
        protected TResponse Post <TRequest, TResponse>(TRequest request)
            where TRequest : APIRequestBodyBase <TRequest>
            where TResponse : APIResponseBodyBase <TResponse>
        {
            _log.DebugFormat("Request:{0}", request.ToString());
            var result = _handler.Handle(() =>
            {
                _restfulClient = _restfulClient ?? new RestfulClient();
                return(_restfulClient.DoPost(request.Url,
                                             request.ContentType,
                                             request.Headers,
                                             request.ToString(),
                                             request.SecurityProtocol,
                                             request.TimeOut,
                                             request.UseSecurity));
            });

            _log.DebugFormat("Response:{0}", result);
            var response = APIResponseBodyBase <TResponse> .Deserialize(result);

            return(response);
        }