This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a method that throws RestClientException from a Java Servlet?
 
Similar Threads
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Could not find trusted certificate
How to get a transfer function to work both ways?
need help urgent please
Returning only minimum value...