Solved

How to POST an audio to a servlet?

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

830 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