ServiceMessage/Client -> PublicInfo

master
mjkhan21 9 months ago
parent 93734208bd
commit c0457a9c07

@ -42,8 +42,7 @@ import cokr.xit.interfaces.lvis.service.seizure.seizure.AddAutoSeizureByEttffRet
import cokr.xit.interfaces.lvis.service.seizure.seizure.FindAltrtvSeizureVhrnoReturn; import cokr.xit.interfaces.lvis.service.seizure.seizure.FindAltrtvSeizureVhrnoReturn;
import cokr.xit.interfaces.lvis.service.seizure.seizure.SeizureProxy; import cokr.xit.interfaces.lvis.service.seizure.seizure.SeizureProxy;
import cokr.xit.interfaces.lvis.service.types.WsRequestContext; import cokr.xit.interfaces.lvis.service.types.WsRequestContext;
import cokr.xit.interfaces.publicinfo.ServiceClient; import cokr.xit.interfaces.publicinfo.PublicInfo;
import cokr.xit.interfaces.publicinfo.ServiceMessage;
/** () Bean /** () Bean
* @author mjkhan * @author mjkhan
@ -154,6 +153,14 @@ public class VehicleInfoBean extends AbstractBean {
if (lvisHost.isLocal()) if (lvisHost.isLocal())
return getLocalExtInfo(req); return getLocalExtInfo(req);
String apiName = "basic-info-ext";
PublicInfo.API api = PublicInfo.api(apiName);
PublicInfo.Request preq = new PublicInfo.Request()
.setUri(api.url())
.header("api_key", api.getKey())
.addData(req);
JSON json = new JSON().configure(objectMapper -> JSON json = new JSON().configure(objectMapper ->
objectMapper.setPropertyNamingStrategy( objectMapper.setPropertyNamingStrategy(
new JSON.CustomPropertyNames().customize(propertyName -> new JSON.CustomPropertyNames().customize(propertyName ->
@ -161,32 +168,19 @@ public class VehicleInfoBean extends AbstractBean {
) )
) )
); );
PublicInfo.Response presp = new PublicInfo.Client()
ServiceMessage.Response sresp = new ServiceClient() .setApi(apiName)
.setConf("basic-info-ext")
.setJSON(json) .setJSON(json)
.request(req); .send(preq);
String body = sresp.getBody(); String body = presp.getBody();
if (sresp.success()) { if (presp.success())
String data = ServiceMessage.Support.peel(body); return json.parse(body, BasicInfoExtResponse.class);
BasicInfoExtResponse resp = json.parse(data, BasicInfoExtResponse.class); else {
Map<String, Object> map = new JSON().parse(body, Map.class);
if (keepLog()) { BasicInfoExtResponse resp = new BasicInfoExtResponse();
create(req, resp); resp.setError(map);
}
return resp; return resp;
} else {
Throwable error = sresp.getError();
if (error != null)
throw runtimeException(error);
else {
Map<String, Object> map = new JSON().parse(body, Map.class);
BasicInfoExtResponse resp = new BasicInfoExtResponse();
resp.setError(map);
return resp;
}
} }
} }

@ -1,12 +1,33 @@
{ {
"basic-info-ext": { /* 자동차 기본정보(연료제원 포함) 조회 설정 이름 */ "host": "http://10.188.225.94:29001",
"apiKey": "59f26bf09ed196bfbd98210388c4c6ea9dd0f77bde3f35526f082647a305325b", /* 행정정보 공동이용 서비스가 발급한 api key */ /* 행정정보 url
"apiUrl": "http://10.188.225.94:29001/piss/api/molit/SignguCarBassMatterInqireService", /* 서비스 api url */ 운영: http://10.188.225.25:29001
개발: http://10.188.225.94:29001
*/
"apis": [
{
"name": "basic-info-ext",
"url": "/piss/api/molit/SignguCarBassMatterInqireService",
"key": "59f26bf09ed196bfbd98210388c4c6ea9dd0f77bde3f35526f082647a305325b",
"userServerId": "SVR1311000030", /* 이용기관 gpki server id */ "userServerId": "SVR1311000030",
"providerServerId": "SVR1500000015", /* 보유기관 gpki server id */ "providerServerId": "SVR1500000015",
"gpki": true,
"gpki": true, /* 데이터 암복호화 사용 여부 */ "mock": false
"mock": false /* 보유기관 가상 데이터 사용 여부 */ }
} ]
/* API 설정 템플릿
{
"name": "이용 API 이름",
"url": "API URL",
"key": "행정정보 공동이용 서비스가 발급한 api key",
"userServerId": "이용기관 gpki server id",
"providerServerId": "보유기관 gpki server id",
"gpki": true, // 데이터 암복호화 사용 여부
"mock": false // 보유기관 가상 데이터 사용 여부
}
*/
} }
Loading…
Cancel
Save