Solved

How to POST an audio to a servlet?

Posted on 2008-09-29
2
282 Views
Last Modified: 2008-10-23
Hi,

I have a requirement.
In the current set up in production. There is a Tomcat server running.
When you call to a particular number it starts an IVR and it routes the call to bevocal and from there it is posted to our Production Tomcat server running.

In order to minimise the call everry time. what i am planning to deploy the whole production application locally on my m/c and i need to post a audio file to my tomcat servlet.

Plz let me know on how i can achieve it.

Regs,
Ravindra N
0
Comment
Question by:getravi2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:getravi2k
ID: 22715223
hi All,

I have solved the problem with this code.

URI doc_url  = new URI("http://localhost:8080/audioxml/XXX_submitRequest.jsp");

                  URI form_uri = new URI(doc_url, "");
                HTTPConnection con = new HTTPConnection(form_uri);

                // create the NVPair's for the form data to be submitted and do the
                // encoding
                NVPair[] files = { new NVPair("upload_file", "C:\\xxx_recordings\\record-2e18f03a.wav") };
                NVPair[] opts  = { new NVPair("secret", "data") };
                NVPair[] hdrs  = new NVPair[1];
                byte[] form_data = Codecs.mpFormDataEncode(opts, files, hdrs);

                // POST the form data, as indicated by the method attribute
                HTTPResponse rsp = con.Post(form_uri.getPathAndQuery(), form_data, hdrs);
0
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 22792635
jsbsudha,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the hope of saving someone else's sanity... About a year ago we bought a Cisco 1921 router with two ADSL/VDSL EHWIC cards to load balance local network traffic over the two broadband lines we have, but we couldn't get the routing to work consi…
Tired of waiting for your show or movie to load?  Are buffering issues a constant problem with your internet connection?  Check this article out to see if these simple adjustments are the solution for you.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question