Tutorial
Following is an example to implement Company Status Inquiry (CheckCorpNums) API by adding the POPBiLL SDK within Java setting.
1. Add POPBiLL SDK
To add POPBiLL Java SDK, input POPBiLL Java SDK dependency information on “pom.xml” file of Spring project and update the Maven.
<dependency>
<groupId>kr.co.linkhub</groupId>
<artifactId>popbill-sdk</artifactId>
<version>1.64.0</version>
</dependency>
2. POPBiLL SDK Setting
Add Company Status Inquiry class into Spring Bean. By referring to the code below, edit “servlet-context.xml” file.
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<annotation-driven/>
<resources mapping="/resources/**" location="/resources/"/>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/"/>
<beans:property name="suffix" value=".jsp"/>
</beans:bean>
<context:component-scan base-package="com.popbill.example"/>
<util:properties id="EXAMPLE_CONFIG">
<!-- LinkID -->
<beans:prop key="LinkID">TESTER</beans:prop>
<!-- SecretKey -->
<beans:prop key="SecretKey">SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=</beans:prop>
<!-- Stage setting value , true(TEST), false(PRODUCTION) -->
<beans:prop key="IsTest">true</beans:prop>
<!-- Whether to recommend use of authentication token IP restriction function or not, -->
<!-- recommended to use (true) -->
<beans:prop key="IsIPRestrictOnOff">true</beans:prop>
<!-- Whether to use POPBiLL API service static IP or not, -->
<!-- true – use, false- do not use, default(false) -->
<beans:prop key="UseStaticIP">false</beans:prop>
<!-- Whether to use local system time or not, -->
<!-- true – use(default – recommended), false – do not use -->
<beans:prop key="UseLocalTimeYN">true</beans:prop>
</util:properties>
<beans:beans>
<!-- Company Status Inquiry Service Implementation Bean registration. -->
<beans:bean id="closedownService"
class="com.popbill.api.closedown.ClosedownServiceImp">
<beans:property name="linkID" value="#{EXAMPLE_CONFIG.LinkID}"/>
<beans:property name="secretKey" value="#{EXAMPLE_CONFIG.SecretKey}"/>
<beans:property name="test" value="#{EXAMPLE_CONFIG.IsTest}"/>
<beans:property name="IPRestrictOnOff" value="#{EXAMPLE_CONFIG.IsIPRestrictOnOff}"/>
<beans:property name="useStaticIP" value="#{EXAMPLE_CONFIG.UseStaticIP}"/>
<beans:property name="useLocalTimeYN" value="#{EXAMPLE_CONFIG.UseLocalTimeYN}"/>
</beans:bean>
</beans:beans>
</beans:beans>
3. Implement CheckCorpNums Function
① To add Service Class Bean object, add @Autowired annotation and registIssue API code.
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.popbill.api.CloseDownService;
import com.popbill.api.CorpState;
import com.popbill.api.PopbillException;
@Controller
public class ClosedownServiceExample {
@Autowired
private CloseDownService closedownService;
@RequestMapping(value = "CheckCorpNums", method = RequestMethod.GET)
public String CheckCorpNum(Model m) {
// Business registration number of a POPBiLL user
String corpNum = "1234567890";
// Array of business registration numbers to search (Maximum : 1,000 inquiries)
String[] CorpNumList = new String[]{"1231212312","6798700433"};
try {
CorpState[] corpStates = closedownService.CheckCorpNum(corpNum, CorpNumList);
m.addAttribute("CorpStates", corpStates);
} catch (PopbillException e) {
// if an exceptional error occurs,
// check the error code with e.getCode()
// and check the error message with e.getMessage()
System.out.println("Error Code : " + e.getCode());
System.out.println("Error Message : " + e.getMessage());
}
return "response";
}
}
② Add response.jsp file that outputs the code and message of the API calling result.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Popbill SDK Response</title>
</head>
<body>
<c:forEach items="${CorpStates}" var="CorpState">
<fieldset>
<ul>
<li>Business registration Number (corpNum) : ${CorpState.corpNum}</li>
<li>Taxation types (taxType) : ${CorpState.taxType}</li>
<li>Company status (state) : ${CorpState.state}</li>
<li>Date of business suspension/closure (stateDate) : ${CorpState.stateDate}</li>
<li>Date of taxation type change (typeDate) : ${CorpState.typeDate}</li>
<li>Confirmed date of status checking from the NTS (checkDate) : ${CorpState.checkDate}</li>
</ul>
</fieldset>
</c:forEach>
</body>
</html>
4. Check the Result
If the API calling is being processed successfully, Response code will be returned as “1” and if it fails, an error code(8-digits that starts with “-”) and error message will be returned to POPBiLL Exception. [Error Code]

