Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling a method that throws RestClientException from a Java Servlet?  RSS feed

Nicole Lim
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Experts,

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
Value: 0402041002_1000102011005701040106
Company Code: 1000
Balance: -91438.20

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?

Example Codes:
Java Servlet -

Java EE Starter Application -

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!