Calling a method that throws RestClientException from a Java Servlet?
posted 4 years ago
I am having some issues calling a method that is residing in a Java EE Starter Application from a Java Servlet in order to display it on the web frontend, a jsp page.
I was able to execute the codes when it is running as a Java EE Starter Application, however when I tried calling the method in Servlet, the program did not execute and jumps back to the index page.
A brief scenario on what I am trying to do:
To retrieve financial accounting balances from SAP NW Gateway and display the information in Java JSP web frontend.
The information flow is as follows:
1) User inputs companycode and glaccount etc in the jsp page and submits the query.
2) Java servlet receives the input through the doPost method.
3) Servlet calls the SAP Gateway consumption service through REST client.
4) SAP Gateway consumption service returns the retrieved account balances information to Serlvet
5) Servlet passes to JSP and displays the information.
I was able to retrieve the data from the Gateway service when running the JAVA SE Starter Application project (see attached codes below).
Printing... Account Balance for 0057010401
Company Code: 1000
Managed to merge it into my existing jsp project.
SAP Gateway consumption service is still working when I run it as a JAVA application.
However, when I tried to call the getPeriodBalances() from a servlet, the code seemed to be rejected. It could not be executed.
No error was caught or returned either.
Am I missing something or doing something wrong in here?