HTTP POST is killing me, please help ...

Hello,
I am trying to send an XML file to a php script sitting on a server. I want to do this by HTTP POST through a Java Application.
I have the following code developed and haven't an iota why the php script won't pick up the XML file.
If anyone has any idea, suggestions, I will be glad to hear them.
Random random = new Random();
final String CONTENT_BOUNDARY = "------------------------" + random.nextInt();
public String postInvoice(String strFilePathName) {
HttpURLConnection httpsUrlConnection = null;
StringBuffer strBuffer = new StringBuffer();
try {
// Using the File name passed in, setup FileInputStream Object
// to be used to get data to write to URL
File fileToPost = new File(strFilePathName);
//FileInputStream fis1 = new FileInputStream(fileToPost);
// Get the actual filename for setting in the form
String strFileName = fileToPost.getName();
URL urlPostTo = new URL("http://server/some.php");
httpsUrlConnection = (HttpURLConnection)urlPostTo.openConnection();
// Setup RandomAccessFile
RandomAccessFile rafXML = new RandomAccessFile(strFilePathName, "r");
httpsUrlConnection.setRequestProperty("REQUEST_METHOD", "POST");
httpsUrlConnection.setRequestProperty("Accept", "text/xml");
httpsUrlConnection.setDoOutput(true);
httpsUrlConnection.setUseCaches(false);
httpsUrlConnection.setRequestProperty("Content-Type",
"multipart/form-data");
Long longTemp = new Long(rafXML.length());
httpsUrlConnection.setRequestProperty("Content-Length", longTemp.toString());
PrintWriter pwOut = new PrintWriter (httpsUrlConnection.getOutputStream());
// Setup a form field
pwOut.print(CONTENT_BOUNDARY + "\r\n" +
"Content-Disposition: form-data; name=\"Filename\"; filename=\"" +
strFileName + "\"\r\nContent-Type: text/xml\r\n\r\n");
// Send XML contents
StringBuffer strBufferFile = new StringBuffer();
long lngFilePointer = 0;
long lngFileLength = rafXML.length();
while (lngFilePointer < lngFileLength) {
String strTemp = rafXML.readLine();
strBufferFile.append(strTemp);
lngFilePointer = rafXML.getFilePointer();
// Write out File Contents
pwOut.print(strBufferFile.toString());
pwOut.print("\r\n\r\n" + CONTENT_BOUNDARY + "--\r\n");
pwOut.flush();
pwOut.close(); pwOut = null;
// Once everything is written, call the connect method
httpsUrlConnection.connect();
System.out.println("Connected to " + httpsUrlConnection.getURL().getHost());
BufferedReader br = new BufferedReader(new InputStreamReader(httpsUrlConnection.getInputStream()));
String strLine;
while ((strLine = br.readLine()) != null)
strBuffer.append (strLine);
strBuffer.append ("\r\n");
br.close(); br = null;
System.out.println(strBuffer.toString());
catch(FileNotFoundException fnfe) {
System.out.println("FileNotFoundException in HttpPostInvoice : " + fnfe);
catch (Exception e) {
System.out.println("Exception in HttpPostInvoice : " + e);
finally {     
if (httpsUrlConnection != null) {
httpsUrlConnection.disconnect();
return strBuffer.toString();
}

Have that application installed and it makes for interesting reading, not sure I understand it all but anyway ..
Using the code you supplied, this is what is picked up
POST /some.php HTTP/1.1
Content-Length: 4844
User-Agent: Java1.4.0_03
Host: www.host.com
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-type: application/x-www-form-urlencoded
POST http://server/some.php HTTP/1.0
Content-Type: multipart/form-data; boundary=-------------------------1736247667
Accept: text/xml
Connection: keep-alive
Content-Length: 4595
Cache-Control: no-cache
Pragma: no-cache
-------------------------1736247667
Content-Disposition: form-data; name="Filename"; filename="3000001193.xml"
Content-Type: text/xml
<?xml version="1.0"?><Order> ... </Order>
-------------------------1736247667--
Using my original code this is what the app picked up ...
POST /some.php HTTP/1.1
Accept: text/xml
Content-Type: multipart/form-data; boundary=------------------------1514140045
Content-Length: 4557
User-Agent: Java1.4.0_03
Host: www.host.com
Connection: keep-alive
------------------------1514140045
Content-Disposition: form-data; name="Filename"; filename="3000001193.xml"
Content-Type: text/xml
<?xml version="1.0"?><Order> ... <Order>
------------------------1514140045--
I really don't know what to make of it, as far as I can see the request header is ok, with the response being 200. That means the request is ok, but shouldn't the response be 201 indicating that the file was created?
Am going to look at what a POST through a HTML form sends and match up that way ...

Similar Messages

  • Problem in BDC for posting an amount feild, please help

    I am doing one batch upload problem. Where I have to upload data from transparent table to amount field into Tcode FPE1. My problem is that when I tried to post this field I get the message 'Field is two big for screen field'. I debugged and found out that when I post amount field (type CURR Length 13 Decimal 2) into Internal table for type BDCDATA, the field get left aligned in Fval-bdcdata field which is of 132 character long. I also tried to change the type of amount field into Char type, but then I get the error 'Enter numeric value'. If you got any idea how to post this amount filed please to pass me.
    Thanks and Regards,
    Shekhar

    Hi Shekhar,
    Use the following:
    DATA:                                 
    zz_menge(16) TYPE c.
    WRITE bseg-menge                
       TO zz_menge UNIT bseg-meins. 
    PERFORM bdc_field                           
           USING 'VBAP-ZMENG(01)' zz_menge.
    (in the example the quantity field BSEG-MENGE is posted to the quantity field in the orderposition).
    Regards,
    John.

  • Flash question...not sure which section to post in...please help the n00b...

    Background: I am a designer (Illustrator/Photoshop) being thrust into the position of creating e-learning materials. I have managed to teach myself the infinitely irritating P.O.S. (piece of software) called Captivate, but am still pretty much useless in Flash.
    I have a project that a former designer created a year or two back. It appears to have been done wholly in Flash, though Captivate may have been involved (not sure why it would have, but I don't know enough about what I'm looking at to be sure). She is no longer with the company, so I can't ask her directly, but I am hoping someone can help me here. The project is essentially Jeopardy, as in the game show. The design is such that it is a static screen (identical to the Jeopardy screen), wherein a user mouse-clicks a value in a category (e.g. Forms for 200), and a window (not an actual browser window, but a flash element) opens over top of the main screen, displaying the question and giving a list of selectable answers (typically multiple choice). Correct and incorrect answers are added or subtracted from the score at bottom. It seems relatively straight-forward (and I'd be happy to post all materials here if that would help anyone answer my question). What I need to do is change these categories/questions to update this material to make it concurrent with a new training course. I am hoping I can do this with the materials I have at hand from the previous designer- ideally, update the text file (I think I can follow the formatting to understand how to update questions/answers/correct answers/etc) and then "plug it in" to this framework...but I don't know. I'm at a loss.
    The outputted Flash file (of no functional use to me, I believe) (.swf)
    The Flash file that contains the framework (this has all "0000" for scores, "Heading" for headings...aka nothing is populated in this framework) (.fla)
    The outputted html file
    A .txt file containing all questions, headings, and values that would populate the framework (example below)
    "&heading1=Banner Forms&
    &heading2=Tricks of the Trade&
    &heading3=Banner Speak&
    &heading4=Surprise!&
    &points1=1000&
    &points2=2000&
    &points3=3000&
    &points4=4000&
    &points5=5000&
    &question1_1=What form do you use to view a Registrar hold?&
    &answer1_1A=TSIAUTH&
    &answer1_1B=SOAHOLD&
    &answer1_1C=SGASTDN&
    &answer1_1D=SHADEGR&
    &correctAnswer1_1=B&"
    It seems that this text file would be imported into the open framework in Flash, but I do not know the first thing about doing any of this. I will eventually be taking some Flash courses, but this project has a much tighter deadline than that.
    Can anyone give me any insight into how to proceed? Please let me know if I should upload these files to link here, if it will help anyone to figure out how this works.
    I apologize for what I imagine is a horribly simple question, but I am truly blind with regards to this material.
    Admins, I apologize if this is not posted in the correct area.
    Thanks ahead of time for any possible help.

    NEAT!
    Hey guy, I got your answer for you. Or should I say hey "IDIOTA".
    You see, that text file is read by the HTML when you access it. As in, there is no "importing" to be done. Simply update the text file as necessary to reflect the categories/questions/answers/correct answers, save changes, and that is that! Provided that you keep the text file in the same directory as the .fla and the html (which you obviously MUST do, or else the Jeopardy screen will show all blanks), you will be good to go! All eagles! All aces! Whatever the phrase is.
    Anyway, hope this helps, chump. Any other dumb questions?

  • It's already the third time that i post the same question, please help me!

    I am writing a simple guestbook that is able to insert and fetch text and image from database and display them. There is a html that forms the parameters to this servlet, some text information such as "name", "address" and one picture. Insertion and fetching of text and images works sepearately, but when i combine them there is a conflict between "doGet" and "doPost". My text insertion only works with "doGet" (don't know why, but when i type "doPost" it does not work) while image insertion only works with "doPost" since i am using "Multipartrequest" to read the image.
    Since i write "doGet" in my code, the exception is following
    java.io.IOException: Posted content type isn't multipart/form-data
    SQLB.doGet(SQLB.java:42)Following are the codes , please give me a hand, many thanks!!
    the problem line that causes exception is marked with ////////////////////////////////// above in red color
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.awt.image.*;
    import com.oreilly.servlet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.oreilly.servlet.ServletUtils;
    import java.net.*;
    import java.sql.*;
    public class SQLB extends HttpServlet{
        Connection con;
        PreparedStatement pstmt=null;
        public void init(){
         //connection need url, username and password
         String url="jdbc:mysql://atlas.dsv.su.se/db_5974722";
         try{
             new com.mysql.jdbc.Driver();
             con = DriverManager.getConnection(url, "usr_5974722", "974722");
         }catch (Exception ex){}
        public void doGet(HttpServletRequest req,HttpServletResponse res)throws IOException, ServletException{
         //get the text fields information     
         String namn=req.getParameter("namn");
         String epost=req.getParameter("epost");
         String hemsida=req.getParameter("hemsida");
         String kommentSQLB.doGet(SQLB.java:42)ar=req.getParameter("kommentar");
         //get the pic as file
         MultipartRequest mreq=null;
         PreparedStatement pstmt1=null;
         PreparedStatement pstmt2=null;
         res.setContentType("text/html");
         String mime=null;
         File file=null;
         File dir = (File)getServletContext().getAttribute("javax.servlet.context.tempdir");
         mreq = new MultipartRequest(req, dir.getAbsolutePath(), 5000000);
         mime= mreq.getContentType("file");     
         file = mreq.getFile("file");
         Statement stmt=null;
         ResultSet rs=null;     
         //first save all the information to the database
         //then go through it and print out all the content
         //both tables have id as key
         try{
             new com.mysql.jdbc.Driver();
             //save the picture
             pstmt2 = con.prepareStatement("INSERT INTO picture(p,type) VALUES ( ?, ?)");
             FileInputStream fis = new FileInputStream(file);
             byte[] data=new byte[(int) file.length()];
             fis.read(data);
             fis.close();
             pstmt2.clearParameters();
             pstmt2.setBytes(1, data);
             //another way to insert blob
             //pstmt2.setBinaryStream(3,fis, (int)file.length());
             pstmt2.setString(2,mime);
             pstmt2.execute();
             //picture saving done
             //save other text information
             pstmt = con.prepareStatement("INSERT INTO guestbook (NAME,TIME,EPOST,HEMSIDA,KOMMENTAR) VALUES(?,?,?,?,?)");
             pstmt.clearParameters();
             pstmt.setString(1,namn);
             pstmt.setString(2,new java.util.Date().toString());
             pstmt.setString(3,epost);
             pstmt.setString(4,hemsida);
             pstmt.setString(5,kommentar);
             pstmt.execute();
             //text informatin saving done
             //pstmt1=con.prepareStatement("DELETE FROM picture");
             //pstmt1.execute();
             //print the guestbook information and invoke the SQLC servlet
             //to display picture
             String queryprint="SELECT * FROM guestbook";
             rs=pstmt.executeQuery(queryprint);
             PrintWriter out=res.getWriter();
             out.println("<HTML><HEAD><TITLE>guestbook</TITLE></HEAD>");
             out.println("<BODY>");
             while ( rs.next() ) {
              String name = rs.getString("id");
              out.println("TID:  "+ rs.getString("TIME"));
              out.println("<br>");
              out.println("FR�N: ");
              out.println("<a href=\"rs.getString(HEMSIDA)\">"+rs.getString("NAME")+"</a>");
              out.println("<br>");
              out.println("e-post");
              out.println("<a href=\"mailto:"+rs.getString("EPOST")+"\">"+rs.getString("EPOST")+"</a>");
              out.println("<br>");
              out.println("Kommentar:  "+rs.getString("KOMMENTAR"));
              out.println("<br><br><br>");
              out.println("<br>");
              out.println("<img src=\"http://localhost:8080/ip/servlet/SQLC?id=" + name+ "\">");
             out.println("</body>");
             out.println("</html>");
                rs.close();
             pstmt.close();
                con.close();
         catch (Exception e){
             e.printStackTrace();
    }

    do you send the mulitipart MIME type like this ?
    <FORM action="youraction"
           enctype="multipart/form-data"
           method="post">

  • Film Noise/Grain is killing me, please help...filter or other ideas?

    Hi all, thanks for your help!
    I have some footage and I shot it with a XL1. I don't know why but there's a ton of static what I would call grain. However, no grain filters or noise filters seem to get rid of it. What's the difference between grain and noise anyway?
    Does anyone have suggestions for how I might get rid the the grain. Motion Blur works but when my interviewee talks it looks ridiculous so I can't use that.
    Thanks,
    Paul

    I had to fix this kind of problem once. The only way I came up with was with Shake, but someone posted some plugins for FCP that might do the trick...
    Check out this thread:
    http://discussions.apple.com/thread.jspa?messageID=1067315&#1067315
    Patrick

  • My 2010 MacBook Pro started running slow a few days ago and is getting worse. I have run a report with EtreCheck that I can post.  Can someone please help me figure out what's wrong and how to fix it.  Thank you.

    Problem started after I unintentionally downloaded some adware 4 days ago. After lots of aggressive ads slowed down my browser I downloaded and ran AdwareMedic which seemed to do the job and browser was back to normal.  Then, possibly a coincidence, everything on the computer started running slower.  I've backed up everything and have run a EtreCheck report.

    When you have the problem, note the exact time: hour, minute, second.  
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    Each message in the log begins with the date and time when it was entered. Scroll back to the time you noted above.
    Select the messages entered from then until the end of the episode, or until they start to repeat, whichever comes first.
    Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of it useless for solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • My iPad 3rd gen does not send emails post newest update. Please help

    MY 3rd generation iPad has stopped sending emails, it all started after the most recent apple update, 3/22/13.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Setting Up An eMail Account
    http://support.apple.com/kb/ht4810
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • Losing Image quality when saving to JPeg and posting on line! Please Help.

    Hi,
    I recently got  a new computer. I use CS3 to edit.  For some reason, whenever I resize the image, save it as a Jpeg and post it to the web, it loses image quality.  Severely.  I've never had this problem before....until this new computer.
    I usually resize the image to 800, then simply click on Save as Jpeg.   Once I resize, it looks fine CS3, but NOT online.
    Just  a picture of my kid. No critiques please! : )

    For blog software, you will have to look under Manage under your admin account. There's an option to define the maximum image size for previews (inline images) and medium image sizes. if they are set to samll, the software will resize them, yet the theme you use may scale them up again to full column width, so they look mooshy. Make sure the image size in the settings panel matches the images you upload. For Facebook it may be similar, but I won't rule out that eitehr of the two services frcibly will change your images to save bandwidth. This should be stated in their terms of use somewhere. If you're merely referring to color shifts, you may wish to check your default color settings and the Embed color profile and Preserve RGB options in the Save for web and Devices dialog.
    Mylenium

  • No Posting or Booting (K7N2), Please Help

    So my friend and I each order the same mobo/processor and we're hanging out installing them.
    MSI K7N2 ILSR
    Athlon XP 3000
    We both get to the point of trying to boot up and neither one of us can even post, let alone boot.  Turns out, his system had ram in DIMM3 and when he moved it out, he booted just fine.
    However, my RAM was in DIMM1&2.  NO matter what 2 banks I use, or even if I try just one stick, I still can't post or boot.  I just get a "NO SIGNAL" on the monitor.
    I've tried it on 3 monitors and get the same thing.
    I've tried my video card in 2 other PC's and it works.
    I've tried other video cards in the system and still no boot or post.
    I've tried using different RAM, nothing.
    I've tested my RAM IN different systems and it works.  
    So I can eliminate the RAM, the Video Card and the Monitor.  I'm wondering if my AGP slot is bad or maybe the processor doesnt work.  I need input on this.
    I've already tried clearing the CMOS and I've already tried switching the jumpers around to safe mode (100mhz).  Any help is greatly appreciated.
    ***EDIT***
    Upon further inspection of the D Bracket lights (top 2 red, bottom 2 green) the manual suggests the processor is bad or not seated properly.  I've reseated it and the lights are in same configuration.  So I'll be getting an RMA and return the processor for a new one.  I ordered from same place, so I'll likely have them replace the board, RAM, Processor, and Cooling Fan.  I'm sure that will take me at least a week to get.  Sigh.
    ***EDIT***
    My complete system
    K7N2 Delta ILSR Mobo
    Athlon XP 3000+, Volcano 10+ Cooling Fan
    2*512 Corsair PC3200
    VisionTek GeForce 4 Ti4600 Video Card 128MB Ram
    550 Watt Power Supply, AMD recommended.

    Quote
    Originally posted by jvree
    I RMA'd the board and the processor, just to be safe and sure neither was the culprit.
    Is it possible for a fried processor to damage the mobo?  I wonder if the processor was bad and could have damaged the mobo.
    At any rate, both were next day air mailed out today.  Hopefully get my replacements early next week.  The RAM works.  Tested it in 3 different machines (including one with the same mobo as I was having the problems with).  
    Thanks for your help everyone.  This is my first MSI mobo, glad I found this site and glad people are willing to help.
    Thank You for having the right attitude!!

  • Task Killer problem, please help !!

    hi all,
    I downloaded the task killer app.
     I clicked on it and and I saw a list of what I think are all programs on my phone.
    I can either put checkmarks on selected apps, then a 'clear selected' button pops up Or a 'kill all' and then a message pops up that says :task koller, available memory 250 mb, 'confirm' ?
    update:.........................Now, every time I am on my main screen of my phone, and I touch the 'task killer' it just stays on my home screen, it doesn't even go to task killer anymore.
    Did I 'kill' the task killer ? lol !
    What Task Killer app seems to work best for everyone and how do you use it properly?  I suppose I need to download another one asap.
    Also....................how do I 'uninstal' an application (like the 1st task killer) once I no longer need it on my phone?
    Thank you

    Trabecca wrote:
    I was told by the moderator of Droid Forums to never use the Advance Task Manager. He said it uses more battery and would cause more problems than just letting the phone close the apps as is needed.  Just an FYI.
    The problem is performance and battery power will suffer before the phone closes the apps as needed.
    Android is a true multi-task mobile OS.  If you open a program then hit your home button, that program will still be left running in the background.  That means the resources it's using are still tied to it.

  • Command or Canvas Events for Recording ?? Please Help..

    Hi I am Abhijith I am a total newbie to the j2me world, And I am learning it now,
    My project topic is "Bluetooth Walkie Talkie " , And I am trying my best and putting
    all my efforts to code incrementally by learning , Before I could implement bluetooth,
    I thought let me complete the recording The audio and playing part first,
    The recording and playing of audio is working fine , But i would like to do it a real manner as Real Walkie talkie does, I want to record audio ONLY when the Key is being
    pressed , and when its released it should exit the player hence saving the recorded file,
    (Actually i dont want to save it in future,i would be sending the bytearray though the bluetooth , but for now , I want the Current module to be ready)
    I tried my best searching online to implement my requirement but the couldnot find
    such events I found Canva's KEYPRESS, KEYRELEASE , etc events but they dint not
    serve my purpose, Let me clearly tell where I am stuck , After the midlet starts(by launching it) then i would like to press a key( keypressed say No 5) for certain
    amount of time and the audio should be recorded only for the keypressed duration ,
    after I release , it should stop recording and save as a wav file .
    Whats happening is When i keep the key pressed , The midlet asks whether to allow
    the recording , for this purpose when I release key the control is going out, and
    i am not able to achieve the needed , I am posting the code here, Please Help me.
    I am not asking for the complete spoon feeding or ready made code, But as a beginner
    I need help from you all to learn and implement it.(at least it should satisfy me,i would feel i have learnt something then)
    Here below is my code ( i AM using WTK 2.5 )
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import java.io.*;
    import javax.microedition.media.control.*;
    import java.util.*;
    import javax.microedition.io.*;
    import javax.microedition.io.file.*;
    public class Key extends MIDlet{
      private Display  display;
      private KeyCodeCanvas canvas;
      public Key(){
        display = Display.getDisplay(this);
        canvas  = new KeyCodeCanvas(this);
      protected void startApp(){
        display.setCurrent(canvas);
      protected void pauseApp(){}
      protected void destroyApp( boolean unconditional ){
        notifyDestroyed();
    class KeyCodeCanvas extends Canvas implements CommandListener{
      private Command exit;
         public StringItem message ;
         private Player player;
         private byte[] recordedAudioArray = null;
      private String keyValue = null;
      private Key midlet;
         Thread t = null;
         private String eventType = null;
      public KeyCodeCanvas(Key midlet){
        this.midlet = midlet;
        exit = new Command("Exit", Command.EXIT, 1);
        addCommand(exit);
        setCommandListener(this);
      protected void paint(Graphics g){
          g.setColor(255, 0, 0);
          g.fillRect(0, 0, getWidth(), getHeight());
        if (keyValue != null){
          g.setColor(0, 0, 255);
           g.drawString(keyValue + eventType+message, getWidth() / 2, getHeight() / 2,
         Graphics.TOP | Graphics.HCENTER);
      public void commandAction(Command c, Displayable d){
        String label = c.getLabel();
        if(label.equals("Exit"))
          midlet.destroyApp(true);
      protected void keyPressed(int keyCode){
         eventType = "pressed";
        keyValue = getKeyName(keyCode);
        repaint();
      public void keyReleased(int keyCode)
           try
                eventType = "released";
                keyValue = getKeyName(keyCode);
                repaint();
           catch (Exception e)
                System.out.print(e);
      public void keyRepeated(int keyCode)
           eventType = "repeated";
           keyValue = getKeyName(keyCode);
           try
                Thread t1 = new Thread()
                     public void run()
                          try
                               player = Manager.createPlayer("capture://audio?encoding=pcm");
                               player.realize();
                               RecordControl rc = (RecordControl)player.getControl("RecordControl");
                               ByteArrayOutputStream output = new ByteArrayOutputStream();
                               rc.setRecordStream(output);
                               rc.startRecord();
                               player.start();
                               eventType = "Recording";
                               message.setText("Recording...");
                               Thread.sleep(5000);
                               message.setText("Recording Done!");
                               rc.commit();
                               recordedAudioArray = output.toByteArray();
                               player.close();
                          catch (Exception e)
                }; t1.start();
           catch (Exception e)
           repaint();
         //Runnable r1 = new Runnable()
         //    public void run()
         //        try
         //            System.out.print(" here 1");
         //            message.setText(" here 1 ");
         //            player = Manager.createPlayer("capture://audio?encoding=pcm");
         //            player.realize();
         //            RecordControl rc = (RecordControl)player.getControl("RecordControl");
         //            ByteArrayOutputStream output = new ByteArrayOutputStream();
         //            rc.setRecordStream(output);
         //            rc.startRecord();
         //            player.start();
         //            eventType = "Recording";
         //            message.setText("Recording...");
         //            Thread.sleep(5000);
         //            message.setText("Recording Done!");
         //            rc.commit();
         //            recordedAudioArray = output.toByteArray();
         //            player.close();
         //        catch (Exception e)
    }I am really sorry at the end I messed with the code and its altered a Lot, But hope the
    logic Will is clear which is my requirement . I know the code for recording and
    playing is not complete as said, i Messed around a working code and tried adding Canavs
    for keyrepeat method,tried putting a thread around , AT last totally messed,
    I tried working on this for two days but couldn't be successfull , Please Help me!!
    The control goes out when midlet asks whether to allow recording ,
    I thank you anticipation ...
    -Abhijith Rao

    Midlet asking whether to allow the recording are typical permissions prompts specified by MIDP security policy. You need to sign the MIDlet and give it proper permissions.
    Problems like this were discussed in an older thread at WTK forum: *[MIDlet keeps asking for permission.|http://forums.sun.com/thread.jspa?threadID=5347313]* According to one of the posters in the thread, +"...I got it to work on the emulator by setting the permission to 'manufacturer'. It runs smoothly without annoying questions..."+
    If you're interested, check documentation and tutorials on MIDP security policy for more details.
    For events to record audio only when the key is being pressed, consider GameCanvas API, method getKeyStates.
    I am not certain though if doing it this way is a good idea. I doubt that phone users have same habits as those of walkie-talkies; for them it might be indeed more comfortable to use single simple key presses to start and finish recording.

  • A Contact I blocked keeps coming back, Please help...

    Hi, recently I have been getting calls from a contact named "- -".  I have tried blocking the user, and reporting abuse, but it keeps comming back.  It has gotten me quite nervous, and I am unsure what to do. I do not dare answer the call, because I fear that it is some hacker, or virus.  Please help, I cannot get rid of/ block the user, and I am sure it is not one of my friends playing a prank on me.
    Also, as I have been looking at my history, I have noticed after I blocked the user, it has appeared as a different contact name.
    If someone knows what to do, an admin or whatever, please post a reply.  PLEASE HELP!!!!!

    Try changing the iPod's drive letter as described in this article.
    http://support.apple.com/kb/TS1493
    B-rock

  • Have problem with my iPAD 4. Trouble with reduce motion, after updating to ios 8.1.2 it start to lag. please help me to fix

    i dont know how to fix this. when i use my 4 fingers gestures. its not animating (fade in/fade out) just delayed for 1 or 2 seconds. my whole iPAD is affected. my msg, apps, etc are getting slower and slower. i checked for my storages its not even full.
    My games are so slow too. aghh. it kills me   please help me to fix this. PLEASE

    Hi taamarco,
    If you are having issues with your iPad's funcionality being reduced, you may want to try some things to troubleshoot.
    First, quit all running applications and test again -
    Force an app to close in iOS - Apple Support
    Next, I would try restarting and if needed resetting the iPad -
    Restart or reset your iPhone, iPad, or iPod touch - Apple Support
    If the issue is still present, you may want to restore the iPad to factory settings -
    Use iTunes to restore your iOS device to factory settings - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L  

  • Please Help - Urgent

    Hi everyone, I�m having problems with Java Mail, I have just installed it along with the java activation framework, they are located in the following directories:
    JavaMail: C:\jdk1.3.1\lib\javamail-1_2[1]
    Java activation framework: C:\jdk1.3.1\lib\jaf1_0_1[1]
    I have the classpath set as: C:\jdk1.3.1\lib\mail.jar;C:\jdk1.3.1\lib\activation.jar
    When I try to compile the sample code provided with these packages, msgsend.java using Jbuilder 2 I get the following errors:
    Error (36): cannot access directory javax\mail.
    Error (37): cannot access directory javax\mail\internet.
    Error (209): class message not found in class msgsend.
    Error (210): class MessagingException not found in class msgsend
    Error (134): class Session not found in class msgsend
    Error (134): variable Session not found in class msgsend
    Error (139): class Message not found in class msgsend
    Error (139): class MimeMessage not found in class msgsend
    Error (141): class InternetAddress not found in class msgsend
    Error (145): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (146): Variable InternetAddress not found in class msgsend
    Error (148): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (149): Variable InternetAddress not found in class msgsend
    Error (151): cannot access class Message.RecipientType;neither class nor source found for Message.RecipientType.
    Error (152): Variable InternetAddress not found in class msgsend
    Error (162): Variable Transport not found in class msgsend
    Error (170): class Store not found in class msgsend
    Error (172): class URLName not found in class msgsend
    Error (172): class URLName not found in class msgsend
    Error (189): class Folder not found in class msgsend
    Error (195): Variable Folder not found in class msgsend
    Error (197): class Message not found in class msgsend
    Error (197): class Message not found in class msgsend
    If I try to use another Java package to compile it I get even more errors (52), I cannot compile it by using the Javac command line compiler, it just says �Bad command or file name�.
    Can anyone tell me Why this is happening and how I might be able to fix it please, I need to start learning Java Mail quickly but at the moment I can�t even begin to do this until I can understand how to get this sample code to work.
    Thanks Everyone
    Noel

    First of all... don't post with topics like "Please Help - Urgent". The topic is supposed to reflect what the question is about.
    Secondly... think for a second. If mail.jar is in C:\jdk1.3.1\lib\javamail-1_2[1]... why are you with your classpath saying that mail.jar is in C:\jdk1.3.1\lib ?
    You classpath is supposed to point directly at you jar-files.
    /Michael

  • HTTP POST Is VPN required?

    Hi experts!!
    I am trying to post some parameters to a url (an external website).
    I am getting a response 404-Not found. I have checked with the developers of the website and they are asking me if a VPN is set up between SAP server and their server.
    Is VPN required for HTTP  Post???
    Please guide me!
    Thank you!!

    Hi !!
    I tried the following code and it seems to be working..
    REPORT xx .
    DATA: status_code(100),
    status_text(100),
    response_entity_body_length TYPE  i.
    *COMPONENT_DATA TYPE DATA.
    TYPES: BEGIN OF text,
           line(120) TYPE c,
           END OF text.
    DATA: request_headers TYPE TABLE OF text WITH HEADER LINE,
          request TYPE TABLE OF text WITH HEADER LINE,
          response_headers TYPE TABLE OF text WITH HEADER LINE,
          response TYPE TABLE OF text WITH HEADER LINE.
    request-line = 'FirstName=YY&Surname=hghgj&Birth=10860319&Gender=F&mail=xxxxdssd.com&Nationality=EL'.
    APPEND response.
    request-line = '&Address1=ddddddddd&Address2=Rafina&City=xxx&Postcode=19009&Country=el&LandTelephone=22374664556'.
    APPEND response.
    request-line = '&Mobiletelephone=fdfdfdfdfdf&Occupation=1&Income=1890087&Networth=10000&NetWorth=1000&Currency=1&Leverage=1'.
    APPEND response.
    CALL FUNCTION 'HTTP_PUT_COMPONENT'
      EXPORTING
        absolute_uri                      = 'xxxxxx-xx.xx/SERVICE/UPDATEUSER'
      RFC_DESTINATION                   =
      PROXY                             =
      PROXY_USER                        =
      PROXY_PASSWORD                    =
      USER                              =
      PASSWORD                          =
      COMPONENT_LENGTH                  =
       blankstocrlf                      = 'X'
    IMPORTING
       status_code                       = status_code
       status_text                       = status_text
       response_entity_body_length       = response_entity_body_length
      TABLES
        request_headers      = request_headers
        response_headers     = response_headers
        response_entity_body = response
        component_data       = request
    EXCEPTIONS
       connect_failed                    = 1
       timeout                           = 2
       internal_error                    = 3
       tcpip_error                       = 4
       system_failure                    = 5
       communication_failure             = 6
       OTHERS                            = 7
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Is there anywhere in SAP i can verify that the values are sent?? Like a trace or something???
    Thank you!!!

Maybe you are looking for

  • How do i write a if statement in SQL?

    say, I have a table has 3 fields: item, invoice, cost In report, if invoice='123', show cost1, if ivoice='456', show cost2 thanks.

  • Windows 2012 System State Backup Fails

    We have a Windows 2012 Domain Controller VM that we would like to backup the System State using DPM. Agent has been installed and the Windows Backup has been added. When the backup runs in DPM, the job fails. Here is the error code: DPM cannot create

  • How to enable Here Drive background task on WP8 Lu...

    Is there anyone who can enable the disabled Here Drive background task? I could enable all other background tasks, but not Here Drive... Restarted the phone and Here Drive a few times, Turn background tasks back on for this app the next time I open i

  • Where to find Photo Jpeg compression?

    Hello guys, I am trying to convert HDV video to Photo Jpeg. I am wondering what would be the best way to do that, achieving the best results? All I can think of is to choose: QuickTime/Uncompressed 10-bit and then go to inspector's Encoder: choose vi

  • DT description cann't be seen in MT

    Hey there, Simple but annoying - in order to use the description given in the Data type during mapping faze I need to see it during mapping. Problem is that the description from the data type don't pass to the Message type. Anyone encountered this is