Java program to get ESS Job log by Web API

ERP Integration Service

The ERP Integration Service provides ERP data inbound and outbound APIs, as well as APIs for checking the status of related jobs and acquiring logs. Among them, [downloadESSJobExecutionDetails](https://docs.oracle.com/cd/E51367_01/financialsop_gs/OESWF/ERP_Integration_Service_ErpIntegrationService_svc_6.htm#oracle.apps.financials.commonModules.shared.model.erpIntegrationService.ErpIntegrationService. It is an API to get the log and output file of the job by specifying the ID.

キャプチャ.PNG

Java program

API service acquisition and access authority acquisition

To get the service, call it with the WSDL and service name as arguments.

URL wsdl = new URL(
		"https://〇〇〇.oraclecloud.com/publicFinancialCommonErpIntegration/ErpIntegrationService?WSDL");
QName serviceName = new QName(
		"http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/",
		"ErpIntegrationService");
erpIntegrationServiceService = new ErpIntegrationService_Service(wsdl, serviceName);

SecurityPoliciesFeature securityFeatures = new SecurityPoliciesFeature(
		new String[] { "oracle/wss_username_token_over_ssl_client_policy" });
erpIntegrationService = erpIntegrationServiceService.getErpIntegrationServiceSoapHttpPort(securityFeatures);

Set a username and password to gain access.

Map<String, Object> reqContext = ((BindingProvider) erpIntegrationService).getRequestContext();

reqContext.put(BindingProvider.USERNAME_PROPERTY, jobUser);
reqContext.put(BindingProvider.PASSWORD_PROPERTY, jobPass);

Log acquisition

Specify the process ID and "log" of the target job in the argument of downloadESSJobExecutionDetails.

try (BufferedOutputStream bos = new BufferedOutputStream(
		new FileOutputStream(new File(logDir + "\\" + logFilename + ".zip")))) {

	List<DocumentDetails> docList = erpIntegrationService
			.downloadESSJobExecutionDetails(essProcId, "log");

	for (DocumentDetails docDetail : docList) {
		bos.write(docDetail.getContent());
	}
} catch (FileNotFoundException e) {
	e.printStackTrace();
} catch (IOException e) {
	e.printStackTrace();
}

Recommended Posts

Java program to get ESS Job log by Web API
[Java] How to get a request by HTTP communication
[Java] Introduction to Stream API
How to implement a job that uses Java API in JobScheduler
How to use Java HttpClient (Get)
[java8] To understand the Stream API
[Introduction to Java] About Stream API
Log output to file in Java
Java 8 ~ Stream API ~ to start now
[MarkLogic] CRUD + α by "Java Client API"
[Introduction to Java] How to write a Java program
[Java] How to measure program execution time
Java 8 to start now ~ Date time API ~
Inexperienced learning methods to get Java Silver 11
Job change from SIer to Web engineer
How to get the date in java
Creating Java Web Applications to Azure Web Apps
Get account information by accessing Strava's API
Introduction to Java Web Apps Performance Troubleshooting
[Java] Program example to get the maximum and minimum values from an array
[Java] How to get HashMap elements by loop control using extended for statement