|
@ -7,6 +7,7 @@ using System.Runtime.Serialization; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Options; |
|
|
using Microsoft.Extensions.Options; |
|
|
|
|
|
using Volo.Abp; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi.XmlHost |
|
|
namespace Win_in.Sfs.Scp.WebApi.XmlHost |
|
|
{ |
|
|
{ |
|
@ -37,11 +38,16 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost |
|
|
{ |
|
|
{ |
|
|
var client = CreateClient(); |
|
|
var client = CreateClient(); |
|
|
var response = await client.PostAsJsonAsync(routeString, input); |
|
|
var response = await client.PostAsJsonAsync(routeString, input); |
|
|
response.EnsureSuccessStatusCode(); |
|
|
if (response.IsSuccessStatusCode) |
|
|
var str =await response.Content.ReadAsStringAsync(); |
|
|
{ |
|
|
|
|
|
var dto = await response.Content.ReadFromJsonAsync<TOutput>(); |
|
|
var dto = await response.Content.ReadFromJsonAsync<TOutput>(); |
|
|
return dto; |
|
|
return dto; |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
var str = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
throw new AbpException(str); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private HttpClient CreateClient() |
|
|
private HttpClient CreateClient() |
|
@ -50,7 +56,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost |
|
|
client.BaseAddress = new Uri(_baseUrl); |
|
|
client.BaseAddress = new Uri(_baseUrl); |
|
|
client.DefaultRequestHeaders.Accept.Clear(); |
|
|
client.DefaultRequestHeaders.Accept.Clear(); |
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
|
|
|
|
|
|
|
|
//XmlHost也使用Jwt认证,并连到同一个IDS4 server,不需要再手工添加鉴权信息了
|
|
|
//XmlHost也使用Jwt认证,并连到同一个IDS4 server,不需要再手工添加鉴权信息了
|
|
|
if (_httpAuthorizationHandler.IsLoggedIn()) |
|
|
if (_httpAuthorizationHandler.IsLoggedIn()) |
|
|
{ |
|
|
{ |
|
|