POPBill Developers
SDK Reference
Java

Tutorial

Following is an example to implement Company Status Inquiry (CheckCorpNums) API by adding the POPBiLL SDK within Java setting.

1. Add POPBiLL SDK

① Download the Java – JSP SDK exemplary code from POPBiLL library and decompress it.

② Copy 3 jar files from the folder within the WEB-INF/lib/ of SDK exemplary code and paste it to the project library folder.

2. POPBiLL SDK Setting

For Company Status Inquiry service configuration setting, generate “$CATALINA_HOME?webapps/ROOT/common.jsp” file within the file path of the project. Then, complete the setting of the authentication information by referring to the code below.

<%-- Generate Company Status Inquiry Service Class Bean --%>
<jsp:useBean id="closedownService" scope="application" class="com.popbill.api.closedown.CloseDownServiceImp" />

<%-- LinkID – enter the provided API credentials information --%>
<jsp:setProperty name="closedownService" property="linkID" value="TESTER" />

<%-- SecretKey– enter the provided API credentials information --%>
<jsp:setProperty name="closedownService" property="secretKey" value="SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=" />

<%-- STAGE configuration setting, true – TEST , false – PRODUCTION --%>
<jsp:setProperty name="closedownService" property="test" value="true" />

<%-- Whether to register the Authentication token registration IP or not (On/Off), true – On(default-recommended), false - Off – PRODUCTION --%>
<jsp:setProperty name="closedownService" property="IPRestrictOnOff" value="true" />

<%-- Whether to use static IP or not, true – true – use static IP, false – do not use static IP(default) --%>
<jsp:setProperty name="closedownService" property="useStaticIP" value="false"/>

<%-- Whether to use local system time or not,  true – use (default – recommended) , false – do not use --%>
<jsp:setProperty name="closedownService" property="useLocalTimeYN" value="true"/>

3. Implement CheckCorpNums Function

Generate the “$CATALINA_HOME/webapps/ROOT/CheckCorpNums.jsp” file. Then, add the code to call API by referring to the example below.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>Popbill Closedown Example</title>
    </head>
<%@ include file="common.jsp" %>
<%@page import="com.popbill.api.CorpState"%>
<%@page import="com.popbill.api.PopbillException"%>
<%

    // 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[] {"1234567890", "6798700433", "401-03-94930"};

    CorpState[] corpStates = null;
    try {
        corpStates = closedownService.CheckCorpNum(corpNum, corpNumList);
    } catch (PopbillException pe) {
            System.out.println("Error Code : " + pe.getCode());
            System.out.println("Error Message : " + pe.getMessage());
        throw pe;
    }
%>
    <body>
        <fieldset>
            <legend>Response</legend>

            <%
                CorpState corpState = null;

                for ( int i = 0; i < corpStates.length; i++ ) {
                    corpState = corpStates[i];
            %>
                <fieldset>
                    <legend>Result [<%=i+1%>]</legend>
                    <ul>
                        <li>Business registration Number (corpNum) : <%=corpState.getCorpNum()%></li>
                        <li>Taxation types (taxType) : <%=corpState.getTaxType()%></li>
                        <li>Company status (state) : <%=corpState.getState()%></li>
                        <li>Date of business suspension/closure (stateDate) : <%=corpState.getStateDate()%></li>
                        <li>Date of taxation type change (typeDate) : <%=corpState.getTypeDate()%></li>
                        <li>Confirmed date of status checking from the NTS (checkDate) : <%=corpState.getCheckDate()%></li>
                    </ul>
                </fieldset>
            <%
                }
            %>
        </fieldset>
        <br>
    </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]