xml api 추가

master
mjkhan21 12 months ago
parent 50904c868d
commit dbfc2ad825

@ -6,6 +6,7 @@ import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -36,8 +37,8 @@ import cokr.xit.interfaces.lvis.service.seizure.SeizureByEttffResponse;
* <pre><code>http(s)://{호스트}/{웹컨텍스트}/intf/lvis/{서비스별 경로}</code></pre> * <pre><code>http(s)://{호스트}/{웹컨텍스트}/intf/lvis/{서비스별 경로}</code></pre>
* @author mjkhan * @author mjkhan
*/ */
@RestController("lvisApi") @RestController("lvisJsonApi")
@RequestMapping(value = "/intf/lvis", name = "자동차 관리정보 api") @RequestMapping(value = "/intf/lvis", name = "자동차 관리정보 (JSON) api", produces = MediaType.APPLICATION_JSON_VALUE)
public class ApiController extends AbstractController { public class ApiController extends AbstractController {
@Resource(name="vehicleInfoService") @Resource(name="vehicleInfoService")
private VehicleInfoService service; private VehicleInfoService service;

@ -0,0 +1,14 @@
package cokr.xit.interfaces.lvis.web;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** REST API <br />
* .
* <pre><code>http(s)://{호스트}/{웹컨텍스트}/intf/lvis/xml/{서비스별 경로}</code></pre>
* @author mjkhan
*/
@RestController("lvisXmlApi")
@RequestMapping(value = "/intf/lvis/xml", name = "자동차 관리정보 (XML) api", produces = MediaType.APPLICATION_XML_VALUE)
public class ApiXmlController extends ApiController {}

@ -8,11 +8,14 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import cokr.xit.foundation.data.JSON; import cokr.xit.foundation.data.JSON;
import cokr.xit.foundation.data.XML;
import cokr.xit.foundation.test.TestSupport; import cokr.xit.foundation.test.TestSupport;
import cokr.xit.interfaces.lvis.service.bean.VehicleInfoBean; import cokr.xit.interfaces.lvis.service.bean.VehicleInfoBean;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtRequest; import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtRequest;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtResponse; import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtResponse;
import cokr.xit.interfaces.publicinfo.ServiceMessage; import cokr.xit.interfaces.publicinfo.ServiceMessage;
import lombok.Getter;
import lombok.Setter;
public class BasicInfoExtTest extends TestSupport { public class BasicInfoExtTest extends TestSupport {
@Resource(name = "vehicleInfoService") @Resource(name = "vehicleInfoService")
@ -182,4 +185,35 @@ public class BasicInfoExtTest extends TestSupport {
req.setVhrno("18도7733"); req.setVhrno("18도7733");
service.getBasicInfo(req); service.getBasicInfo(req);
} }
@Test
void xml() {
XmlTest resp = new XmlTest();
resp.setId("아이디-00");
resp.setName("이름-00");
XML xml = new XML();
try {
System.out.println(xml.stringify(resp, true));
} catch (Exception e) {
e.printStackTrace();
}
String str = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n"
+ "<response>\r\n"
+ " <id>아이디-00</id>\r\n"
+ " <name>이름-00</name>\r\n"
+ "</response>";
XmlTest resp2 = xml.parse(str, XmlTest.class);
System.out.println(resp2);
}
@Getter
@Setter
public static class XmlTest {
private String id;
private String name;
private String contact;
}
} }
Loading…
Cancel
Save