aspose file tools*
The moose likes Web Services and the fly likes Calling a method that throws RestClientException from a Java Servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Calling a method that throws RestClientException from a Java Servlet?" Watch "Calling a method that throws RestClientException from a Java Servlet?" New topic
Author

Calling a method that throws RestClientException from a Java Servlet?

Nicole Lim
Greenhorn

Joined: Apr 20, 2012
Posts: 1
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).
Output:
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 - testServlet.java


Java EE Starter Application - balance.java

 
Consider Paul's rocket mass heater.
 
subject: Calling a method that throws RestClientException from a Java Servlet?