Solved

How to POST an audio to a servlet?

Posted on 2008-09-29
2
243 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
2 Comments
 

Author Comment

by:getravi2k
Comment Utility
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
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

We've been using the Cisco/Linksys RV042 for years as: - an internet Gateway - a site-to-site VPN device - a leased line site-to-site subnet-to-subnet interface (And, here I'm assuming that any RV0xx behaves the same way as an RV042.  So that's …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now