×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    7

    Nokia NFC 6212 emulator: java.io.ioexception: error in http operation

    Hi,
    Im using Series 40 Nokia 6212 NFC SDK...
    Im doing HTTP post operation.. its working fine in emulator installed in my PC...
    Code:
    	
    try
    	{
    	  HttpConnection conn = (HttpConnection) Connector.open("http://12.345.67.891/aceweb/parse.aspx");
    	  conn.setRequestMethod(HttpConnection.POST);
    	  byte data[] = Msg.getBytes();
    	  // data should be filled with binary data to send
    	  conn.setRequestProperty("Content-Length", Integer.toString(data.length));
    	  conn.setRequestProperty("Content-type", "application/octet-stream");
    	  OutputStream sending = conn.openOutputStream();
    	  sending.write(data);
    	  sending.flush();
    	  sending.close();
    		
    	  //Read response status
    	  String Resp = new String(conn.getResponseMessage());
    	  System.out.println("RespStat: " + Resp+"\n");
    	  //Read the response data
    	  if (conn.getResponseCode() == HttpConnection.HTTP_OK)
    	   {
    	       	status = true;
    	       	System.out.println("\nHTTP OK\n");
    	        is = conn.openDataInputStream();
    	        int chr;
    	        while ((chr = is.read()) != -1)
    	        sb.append((char) chr);
    
    	        // Web Server returns
    	        System.out.println("RespData: " + sb.toString());
    	            
    	        is.close();
    	        }
    	        else
    	        {
    	        	status = false;
    	        	System.out.println("Response unknown: " + conn.getResponseCode());
    	        }        
    		conn.close();
    		}
    		catch(Exception e)
    		{
    			status = false;
    			System.out.println("HTTP SendErr: "+e.toString()+"\n");
    //java.io.ioexception: error in http operation
    		}
    Recently I installed Emulator and other necessary tools in another system and when I tried to execute this code its throwing exception as "java.io.ioexception: error in http operation"
    I made sure security domain is set to "Maximum" in emulator..

    Its the same story when I installed and tried in one more system..

    What might be the problem?

    Thanks in advance

    With regards,
    Harsha

  2. #2
    Registered User
    Join Date
    Jul 2010
    Posts
    7

    Re: Nokia NFC 6212 emulator: java.io.ioexception: error in http operation

    Hi,
    In the newly installed system, on further debugging I observe HTTP request traffic. It contains only 3 headers(Content type, Accept, User agent)!!!!!!!!
    However in my PC, HTTP request traffic contains 7 headers(Host, Content-type, Accept, Content-length, Accept, Connection, User agent)
    So how can I force other missing headers in the code or in settings?
    What is making emulator to send only these 3 headers?

    Thanks in advance

    With regards,
    Harsha

Similar Threads

  1. java.io.IOException: Error in HTTP operation
    By varma_111 in forum Mobile Java Networking & Messaging & Security
    Replies: 19
    Last Post: 2011-10-16, 09:27
  2. java.io.IOException: Error in HTTP operation in S40 5th edition SDK
    By gopicsq in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2010-07-11, 03:28
  3. java.io.IOException: Error in HTTP operation on S-40 Emulator
    By Rupa in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2010-07-07, 20:32
  4. Getting java.io.IOException: Error in Http operation
    By techendeavour_abhijeet in forum Mobile Java General
    Replies: 3
    Last Post: 2009-05-29, 07:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×