# How to call java apis

**URL:** <https://www.ruby-forum.com/t/how-to-call-java-apis/86016>\
**Category:** Rails\
**Created:** [February 19, 2007, 2:32am UTC](https://www.ruby-forum.com/t/how-to-call-java-apis/86016 "2007-02-19T02:32:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 19, 2007, 2:32am UTC](https://www.ruby-forum.com/t/how-to-call-java-apis/86016/1 "2007-02-19T02:32:56Z")

</div>

Hi,

In my application, I have to make 3rd party java apis. Actually, I have  
to use a sms gateway provider’s apis. They have a java sdk which I have  
to use to send and receive sms. How can I call java apis from within a  
controller?

In my controller, I have to receive request and use the java api to get  
the data out of request. Process the data in controller action and then  
send the result back as sms using the api to send sms. How can I call  
java apis from a controller action ?

Thanks.

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 19, 2007, 4:14am UTC](https://www.ruby-forum.com/t/how-to-call-java-apis/86016/2 "2007-02-19T04:14:42Z")

</div>

The most generic solution I can think of would be to wrap the Java SMS  
API so that it’s exposed through 1 or more Web Service APIs. You  
could write the wrapper in either Java or Ruby/JRuby.

I regularly use this approach to talk to “foreign” APIs; I just  
finished doing exactly this to let me refer to a datastore that’s  
actually a TestDirector defect database.

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 19, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/how-to-call-java-apis/86016/3 "2007-02-19T23:10:02Z")

</div>

I second that. It’s exactly what we’re doing on to wrap some java  
api’s. We’re using Apache AXIS to help simplify things.
