Tutorial
Following is an example to implement NTS Crawling job request (RequestJob) 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 NTS Crawling 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 NTS Crawling (e-Tax Invoice) Service Class Bean --%>
<jsp:useBean id="htTaxinvoiceService" scope="application" class="com.popbill.api.hometax.HTTaxinvoiceServiceImp" />
<%-- LinkID – enter the provided API credentials information --%>
<jsp:setProperty name="htTaxinvoiceService" property="linkID" value="TESTER" />
<%-- SecretKey– enter the provided API credentials information --%>
<jsp:setProperty name="htTaxinvoiceService" property="secretKey" value="SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=" />
<%-- STAGE configuration setting, true – TEST , false – PRODUCTION --%>
<jsp:setProperty name="htTaxinvoiceService" 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="htTaxinvoiceService" 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="htTaxinvoiceService" property="useStaticIP" value="false"/>
<%-- Whether to use local system time or not, true – use (default – recommended) , false – do not use --%>
<jsp:setProperty name="htTaxinvoiceService" property="useLocalTimeYN" value="true"/>
3. Implement RequestJob Function
Generate the “$CATALINA_HOME/webapps/ROOT/RequestJob.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 HTTaxinvoice Example</title>
</head>
<%@ include file="common.jsp" %>
<%@page import="com.popbill.api.hometax.QueryType" %>
<%@page import="com.popbill.api.PopbillException"%>
<%
// Business registration number of a POPBiLL user
String corpNum = "1234567890";
// Type of e-Tax invoice
// SELL – sales
// BUY – purchase
// TRUSTEE - consigned
QueryType TIType = QueryType.SELL;
// Date type
// W – date of preparation
// I – date of issuance
// S – date of filing
String DType = "S";
// Starting date (format : yyyyMMdd)
String SDate = "20220101";
// End date(format : yyyyMMdd)
String EDate = "20220130";
String jobID = null;
try {
jobID = htTaxinvoiceService.requestJob(corpNum, TaxinvoiceType, DType, SDate, EDate);
} catch (PopbillException pe) {
// If an exceptional error occurs,
// check the error code with pe.getCode()
// and check the error message with pe.getMessage()
System.out.println("Error Code : " + pe.getCode());
System.out.println("Error Message : " + pe.getMessage());
throw pe;
}
%>
<body>
<p>Response</p>
<br/>
<fieldset>
<legend>Response</legend>
<ul>
<li>JobID for a request (JobID) : <%=jobID%></li>
</ul>
</fieldset>
</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]

