Regarding getting data through network...

Hi All,
The program code I have given below is hanging and not even raising any exception, not even timeout, why I could not understand. Please Help...
Example URL: http://www.mymortgagepros.com
Please try this code on this URL, I am getting problem on this URL, Some Urls whereas are working perfect...
public String getBufferedData(String str) {
URL url = null;
String line = null, body = null;
InputStreamReader in = null;
BufferedReader buffer = null;
URLConnection myConn = null;
StringBuffer sb1 = new StringBuffer("");
try {
     url = new URL(str);
     myConn = (HttpURLConnection)url.openConnection();
     myConn.setRequestProperty("User-agent","");
     buffer = new BufferedReader(new InputStreamReader(myConn.getInputStream()));//*****
     while ((line = buffer.readLine()) != null) {
     System.out.println("We are here3 in loop...");
     sb1.append(line);
     buffer.close();
     body = new String(sb1);
}catch(MalformedURLException mx) {
     System.out.println("MalformedURLException ");
     System.out.println(mx.getMessage());
}catch(IOException ix) {
     System.out.println("IOException ");
     System.out.println(ix.getMessage());
}catch(Exception ex) {
     System.out.println("Exception ");
     System.out.println(ex.getMessage());
}finally {
     try {
     if(myConn != null)     myConn = null;
     }catch(Exception e) {
System.out.println("Exception in Finally");
System.out.println(e.getMessage());}
return body;
Thanks in advance...
Srinivas P.

Hi
You Must have a listener for your comm port e.g
private class CommListener implements SerialPortEventListener{
case SerialPortEvent.DATA_AVAILABLE:{
while(true){
try{
ch = is.read();
if(ch==-1)
break;
buf.append((char)ch);
}catch(IOException ioe){
System.out.println(buf.toString());
}

Similar Messages

  • Get data over network

    Hello,
    I want to know how could i get data over network. I mean i have a video server and i want to get the data flow (so i don't need a MediaLocator which runs with URL file.. not an http address or else..) and store it in a buffer (bytebuffer?) or in a datasource...
    If you have an idea to do this.
    Thanks

    Im trying ot transfer webcam lifestream over the internet to a specific user.
    It works in my home network but does not over the internet
    What Im doing is:
    create the processor using ContentDescriptor.RAW_RTP
    create the transmitter using the user IP
    localAddr = new SessionAddress( InetAddress.getLocalHost(),
    portNumber ) ;
    destAddr = new SessionAddress( ipAddr, portNumber );
    rtpManagers.initialize( localAddr );
    rtpManagers[i].addTarget( destAddr );
    Thx for any help

  • Send encryption data through network

    I'm doing encryption data exchanging project. I can describe my scenario anyone can give me good suggestion.
    I use RSA Key pair. Client side encrypt the data using private key and server decrypt those data using particular public key. I store my keys in keystore. For one attempt I use public and private keys belong to one alias. My problem is when doing decryption in server side I got error message (BadPaddingException: Data must start with zero). But if I do encryption and decryption in same class using same keys without any client/server connection it works properly.
    So, if anyone can give me any advice or suggestion, I'm very appreciat

    ivanovpv wrote:
    I think problem is somewhere in data transmission. During transmission either server or client adds extra padding information.No. For symmetric block based encrypted the clear text has to be padded to make it a full block. This is normally done as part of the encryption process using PKCS5 padding. Padding is also reqired for RSA encryption so as to make sure the cleartext ^ public_exponent is greater than the modulus. This is normally done using PKCS1 padding.
    If the encrypted data is corrupt then one normally gets a exception such as BadPaddingException when decrypting using a symmetric algorithm or an exception indicating that the padded data should start with a zero in the case of RSA encryption.
    It is almost certain that the OP has corrupted his encrypted data or his key, possibly by converting to a String without using Hex or Base64 encoding. Without seeing his code we will probably never know.
    >
    I would suggest just get your public key (i hope it's just a long/String probably wrapped within some class) then explicitly convert it into character array (best is to use UTF-8 encoding) - then transmit through network. On other side decode from UTF-8 character array into long/String - probably you'd need to instantiate public key object from your long/String and enjoy!String should never be used as a container for binary data and keys are binary data. Just converting them to a String specifying utf-8 will almost certainly corrupt them. If one must have a String version of any binary data whether it be a key or cipher text one should reversibly encode it using something like Base64 or Hex.

  • Clarification on details regarding getting data from APO into BW

    Hi Friends,
    I need some clarification in terms of getting data from APO into BW for reporting:
    I observed that SAP has provided standard data flows for PPDS module, where as for the Demand Planning and Supply Network Planning SAP has just provided some standard InfoCubes ex: 0APO_C07, 0APO_C10, 0APO_C11, 0APO_C12.
    Which makes me believe that for Demand Planning and Supply Network Planning we need to generate DataSources from the Planning books in DP & SNP and build our own custom data flows. In that case what is the use of above mentioned InfoCubes provided by SAP?
    Also in my current project the client has built a custom DataSource on top of a Planning Book in DP and created custom data flow in BW for reporting and also created a Back up cube in APO.
    My question on this is, what is the use of this Back up cube in APO, what is the need to maintain two same cubes in two different systems?
    My next question is, I have installed complete data flow for 0APO_C02 (Orders Data) in BW and loaded data. In SAP documentation it says when we try to load data for a particular date range using this InfoSource (0APO_PPDS_ORDER_01), it directly loads data from the live cache.
    Is there a way to know if the data is coming from Live Cache or from APO server, can we get data from live cache for 9A*** Datasources also, which we create on planning books in DP and SNP?
    Any comments and Info will be greatly appreciated. Thanks!

    Hi Sunitha, thanks for your inputs. So does that mean for Demand Planning and Supply Network Planning, SAP has not given any standard DataSources because it makes more sense to build DataSources from the planning books as each company has their own planning strategies based on how they do there business. Right?
    And for these modules there is no other way rather than generating DataSources from Planning Books and build the Data Flows based on it. Right?
    Also these generated DataSources i.e. 9A**** pull data from live cache itself right or is there any setting that we need to enable for it to get data from live cache?
    Thanks again for your valuable inputs hope to get answers to above questions as well.

  • Please::Getting Data Through Setting Focus On Row in ADFReadOnly Table ? ??

    Hi All ;
    By clicking on tableSelectOne on Row in ADFReadOnly I can Get All of the rest of the Row Data in inputtexts ;
    I want To Do The Same Action not By clicking on tableSelectOne but by clicking on any Cell On This Row , Can any body help by example ??
    Regards;

    Abu,
    here's a website full of such hints
    http://www.oracle.com/technology/jsf/index.html
    your usecase is
    http://vgoldin.blogspot.com/2007/01/Weing-aftableselectone-by-clicking.html
    Frank

  • Sending data through network takes forever

    hi fellow java developper
    i'm developping a program that hides files contents trough xml messages in order to exchange securily from a intranet to an extranet whitout having to use ftp and port 21. The problem is it takes over 22 seconds to send a 22k from the server and it takes about 85 seconds to receive it on the client side. this is driving me nuts because i know that delay is extremely high. IS there a way to optimized those to following methods so that the delay is reasonnably cut down
    thanks in advance
    here is my code to send and receive data,
    private BufferedInputStream inBuffer; // input buffer
    private BufferedOutputStream outBuffer; // output buffer
    * Method to send a String to the client
    * @param content is the string to send to client
    public void send(String message) throws IOException
    ByteArrayOutputStream streamOfBytes;
         DataOutputStream insStream_Out;
         streamOfBytes = new ByteArrayOutputStream(message.length());
    insStream_Out = new DataOutputStream(streamOfBytes);
         for (int i = 0; i < message.length(); i++)
              insStream_Out.write((byte)message.charAt(i));
         outBuffer.write(streamOfBytes.toByteArray(), 0,streamOfBytes.size());
         outBuffer.flush();
         * This method permit reception of string messages
         * @param a single character identifying the terminator to avoid receiving garbage
         * @return a string containing the message
         public String receive(char terminal) throws IOException
         char c;
         String message = "";
    long start = System.currentTimeMillis();
    int i = 0;
         while ((c = (char)inBuffer.read()) != terminal)
         message = message + String.valueOf(c);
    i++;
         long end = System.currentTimeMillis();
    System.out.println("temps requis recevoir:" + (end - start) +" ms nbboucle:"+i);
    return message ;
         }

    Hmmm.. there are a few optimization possibilities here, both with respect to creating bytes and retrieving text from bytes again. This is more close to the way java does it, and also the recommended way:// Push data out to a byte[] like this:
    String data; // initialized elsewhere
    ByteArrayOutputStream target = new ByteArrayOutputStream( data.length() );
    DataOutputStream stream = new DataOutputStream();
    stream.writeUTF( data );
    stream.flush();
    byte[] bytes = target.toByteArray();
    // Read data in from an InputStream like this:
    InputStream input; // initialized elsewhere
    DataInputStream stream = new DataInputStream( input );
    StringBuffer result = new StringBuffer();
    try
       // terminates with an EOFException
       // (ridicolous, but that is what the specification says...
       while( true )
          result.append( stream.readUTF() );
    catch( EOFException e )
    return result.toString();However, if your code works, the times you talk about is probably not connected to bad code (unless your XML is really really big) but more likely to network problems. Note that if your output string results in a byte array larger than 65535 bytes, a DataFormatException will be thrown from writeUTF (so the method fails). In that case, you will have to use OutputStreamWriter / InputStreamWriter and specify encoding to be e.g. UTF-8.
    Good luck!
    Daniel

  • Regarding getting data from excel file and need to generate  inbound idoc

    Hi guys,
    Please can u give some example how to get excel file data and need to generate the inbound idoc my questation ? Is it possible to generate inbound idoc with the same logical system ( it seems to be not possible using same logic to generate idoc ) can u suggest me any posssibule way to generate idoc.) if possible give me some example.
    Regardng
    anil
    Edited by: anil kumar on Aug 8, 2008 1:35 PM

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • Get data through query all non validated invoices and unaccounted invoices

    Hi expert,
    I could not find flag in ap_invoices_all to find such invoice which are not accounted yet or such invoices which are not validated.
    please tell me column name used for both condition or give me query to find such records.
    Thanks

    Hi,
    If it's 11i, you can do this by linking with ap_invoice_distribution table . Checking match_staus_flag for validation and accounting date for accounted invoices ..
    Regards
    Muthu

  • Getting data through com port

    how can i understand that data is sent tome through a com port.
    i use dataavailable event but when i read the data iread just meanless codes and it can not be.
    i use javax.comm for my project..

    Hi
    You Must have a listener for your comm port e.g
    private class CommListener implements SerialPortEventListener{
    case SerialPortEvent.DATA_AVAILABLE:{
    while(true){
    try{
    ch = is.read();
    if(ch==-1)
    break;
    buf.append((char)ch);
    }catch(IOException ioe){
    System.out.println(buf.toString());
    }

  • Filter and sorting on table when getting data through store proc

    Hi All,
    I am using JDeveloper 11g and trying to implement a table which gets its data from a result set returned by a store procedure. The store procedure is using joins to fetch data from multiple oracle tables. I am able to display the data by binding result set element to each columns of ADF table, but sorting and filtering is not working on this, I have checked the chek box while creating table to make it sortable and filtering.
    Please help on this issue. How can we implement filtering and sorting in this case?
    Thanks in advance
    Saurabh agarwal

    Hi,
    I use managed bean directly to access data. My back end returns me a map with the values and these values are then mapped to columns.
    Can you please suggest me any link or example where this model supporting filter is used.
    Thanks
    Saurabh

  • Materialized view on a Partitioned Table (Data through Exchange Partition)

    Hello,
    We have a scenario to create a MV on a Partitioned Table which get data through Exchange Partition strategy. Obviously, with exchange partition snap shot logs are not updated and FAST refreshes are not possible. Also, this partitioned table being a 450 million rows, COMPLETE refresh is not an option for us.
    I would like to know the alternatives for this approach,
    Any suggestions would be appreciated,
    thank you

    From your post it seems that you are trying to create a fast refresh view (as you are creating MV log). There are limitations on fast refresh which is documented in the oracle documentation.
    http://docs.oracle.com/cd/B28359_01/server.111/b28313/basicmv.htm#i1007028
    If you are not planning to do a fast refresh then as already mentioned by Solomon it is a valid approach used in multiple scenarios.
    Thanks,
    Jayadeep

  • How to get Data from SAP B1 through Journal Entries objects (Excel VBA)

    Hi Genius
    i had try to login SAB B1 thorugh MS Excel VBA code and it worked well. but i need some questions regards getting the data from after login. that means i want the Posting date, Transaction No, account code, debit and credit amount from Journal entries posted in a particular day through MS excel VBA into excel sheets 1 cell A1:E1
    how i get it if any possible ways to do that
    here my code to login
    Public Sub login()
        Sheets("Login").Select  'access the login tab
        Worksheets("Login").Range("B1").Activate 'put focus on cell B1 (manager)
        B1UserID = Trim(ActiveCell.Value2) 'set Businsss One user
        ActiveCell.Offset(1, 0).Activate
        B1Password = Trim(ActiveCell.Value2) 'set Business One password
        ActiveCell.Offset(1, 0).Activate
        sqluser = Trim(ActiveCell.Value2) 'set SQL user
        ActiveCell.Offset(1, 0).Activate
        sqlpass = Trim(ActiveCell.Value2) 'set SQL password
        ActiveCell.Offset(1, 0).Activate
        Db = Trim(ActiveCell.Value2)      'set Database name
        ActiveCell.Offset(1, 0).Activate
        Server = Trim(ActiveCell.Value2)  'set Server name
        Set company1 = New SAPbobsCOM.Company  'initialate DI company object
        company1.DbServerType = dst_MSSQL2005
        company1.Server = Server
        company1.DbUserName = sqluser
        company1.DbPassword = sqlpass
        company1.CompanyDB = Db
        company1.UserName = B1UserID
        company1.Password = B1Password
        'connect to the database
         lRetCode = company1.Connect
            If lRetCode <> 0 Then
                sErrMsg = company1.GetLastErrorDescription
                MsgBox (sErrMsg)
            Else
                MsgBox ("Connected to: " & company1.CompanyName)
            End If
    End Sub
    pls help me
    advance thanks to solvers

    Gordons way is the easiest - just query the OJDT table for journal entry headers and JDT1 for journal entry lines if needed.
    But if you want to work with the business objects:
    'Journal entry
       Dim oJE As SAPbobsCOM.JournalEntries
       Set oJE = company1.GetBusinessObject(oJournalEntries)
       oJE.GetByKey(1234)
       Dim postingDate as String
       postingDate = oJE.DueDate
    'etc etc

  • While import data through ff_5 i am getting error

    hello
    while import data through ff_5 i am getting error  as below
    message error fv150 and fv151
    'Termination in statement no. 00009 of acct
    1101200570116; closing record 62F missing'
    so please give solution
    thank inadvance
    SIRI

    Dear Siri,
    I guess you are importing an MT940 format. This format should have the closing balance at the end.
    This closing balance starts with :62F:
    A sample is
    :61:0801180118DR3835,97NTRF000000//000000//
    :86:1022  LTD CHENNAI18012008
    :61:0801180118DR69885,09NCHK850819//850819//
    :86:6101  LTD COCHIN18012008
    :62F:C080118INR7210048,86
    I guess that is missing in the import file.
    Maintain that and the import will happen.
    Assign points if useful
    regards
    Venkatesh

  • Unexpected results getting data from two fact tables through conformed dim

    Hi all,
    We are getting an unexpected behaviour in our OBIEE 10.1.3.3.3. We have this scenario:
    We have {color:#0000ff}2 fact tables{color}{color:#000000} called F1 and F2. F1 has one measure, f1m1 and F2 has another one, f2m1.
    We have {color:#0000ff}4 conformed dimensions{color}, called D1, D2, D3, Date.
    When we are requesting for individual fact tables, we are getting:
    date d1 d2 d3 f1m1
    dt1 - x - y - z - m1
    dt1 - x - y - z' - m2
    date d1 d2 d3 f2m1
    dt1 - x - y - z - m3
    dt1 - x - y - z'' - m4
    But, trying to obtain a compare scenario, we are getting
    date d1 d2 d3 f1m1 f2m1
    dt1 x y z m1 m4
    Instead of
    date d1 d2 d3 f1m1 f2m1
    dt1 x y z m1 m3
    Looking at query log, we have catched the reason. That's why BI Server is using to solve this request using ROW_COUNT() to join SAWITH0 and SAWITH1 in SAWITH2 result set. So, the order may not be the same in the results sets in every fact table. More or less, generated query is like:
    WITH
    SAWITH0 AS
    (select ....
    from F1),
    SAWITH1 AS
    (select ...
    from F2),
    SAWITH2 AS
    select from (select ...
    ROW_NUMBER() OVER PARTITION (....) c10
    from SAWITH0.d1 full outer join SAWITH1.d1 ....) D1
    {color:#ff0000}where (D1.c10 = 1){color}
    select SAWITH2. ....
    from SAWITH2
    order by c1..c10
    The problems seems to be that BI server is ordering the result sets SAWITH0 and SAWITH1 and getting row number to join this results sets, but this is not getting the correct result.
    Any ideas?
    TIA
    Javier
    {color}
    Edited by: jirazazábal on Mar 13, 2009 2:46 PM

    I have done a logical fact table with two fact table source on it.
    The Sql performed against the database was this one.
    -------------------- Sending query to database named PRODS_AIX (id: <<153418>>):
    WITH
    SAWITH0 AS (select sum(T21296.CONSUMERS_SALES_EURO) as c1,
         T21309.DIVISION_CODE as c2
    from
         DIVISION T21309,
         C_CONSUMERS_SALES T21296
    where  ( T21296.DIVISION = T21309.DIMENSION_KEY )
    group by T21309.DIVISION_CODE),
    SAWITH1 AS (select sum(T21356.ORDER_VALUE) as c1,
         T21309.DIVISION_CODE as c2
    from
         DIVISION T21309,
         DWH_SALES_ORDER_OVERVIEW T21356
    where  ( T21309.DIMENSION_KEY = T21356.DIVISION_KEY )
    group by T21309.DIVISION_CODE)
    select distinct case  when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c2 is not null then SAWITH1.c2 end  as c1,
         SAWITH0.c1 as c2,
         SAWITH1.c1 as c3
    from
         SAWITH0 full outer join SAWITH1 On nvl(SAWITH0.c2 , 'q') = nvl(SAWITH1.c2 , 'q') and nvl(SAWITH0.c2 , 'z') = nvl(SAWITH1.c2 , 'z')
    order by c1As you can see one select (SAWITH0) for the first fact table C_CONSUMERS_SALES and one select for the second fact table DWH_SALES_ORDER_OVERVIEW (SAWITH1 ) and the two statement are joined with a full outer join.
    I ask me why you have the three select (SAWITH0,SAWITH1 and SAWITH2). Can you please paste the complete SQL performed ?
    Can you tell us also which SQL is performed if you select only the columns from one fact table and not for the other ?
    Regards
    Nico
    http://gerardnico.com

  • Getting date and time format through RIDC call

    Hello,
    i want to set date and time features to my document , how can i get the date and time from RIDC call
    Regards
    Mayur Mitkari

    Hello
    I am performing this operation for getting date
    username = Util.getInstance().getCurrentUser().toString();
    IdcClient myIdcClient = Util.getInstance().getUCMConnection();
    IdcContext myIdcContext = new IdcContext(username);
    DataBinder binder = myIdcClient.createBinder();
    binder.putLocal("IdcService", "COLLECTION_GET_COLLECTIONS");
    binder.putLocal("hasCollectionID", "true");
    binder.putLocal("dCollectionID", parentNodeID);
    idcResponse = myIdcClient.sendRequest(myIdcContext, binder);
    DataBinder serverBinder = idcResponse.getResponseAsBinder();
    DataResultSet resultSet = serverBinder.getResultSet("COLLECTIONS");
    folderInfoList = new ArrayList<String>();
    resultInfoList = new ArrayList<List>();
    Iterator itr = resultSet.getRows().iterator();
    while (itr.hasNext())
    String dCreateDate = dataObject.get("dCreateDate").toString();
    but i am getting date in this format "2012-05-22 08:26:52Z"
    if i want the date in local timezone what can i do
    Regards
    Mayur Mitkari

Maybe you are looking for

  • Urgent -- using Standard text in SMart forms

    Hi Techi's. I have created a standard text using SO10 , and included the same in smartform. But the requirement is , i need to change the format of the standard text with my own style, so i craeted a Smart style with relevant Paragraph  and Character

  • Version 8 takes longer to burn CD's on songs I purchased

    Hi, I have noticed that ever since I upgraded to version 8, it takes longer to burn CD's of songs I purchased. Has anyone else noticed this? It takes about anywhere from 10 to 15 minutes

  • Subsequent dr/cr

    hi, i would like to know subsequent debit/credit can do after a or b or both also possible. 1) vendor approaches with additional amount invoice or correction in Invoice after the invoice is posted. may i know subsequent debit or credit only can do wh

  • Trying to update my 5800

    For 3 hours I'm trying to update my 5800. Tried with OVI suite, no luck, moved to PC Suite, again, no luck. 30 times. This is absolutely ridiculous, can't Nokia make it harder? Or, maybe, don't provide updates at all? This way, I spent half of my day

  • Query not opened

    Hi All, I transported query from dev to QA . In QA that query is not opening. it is giving error " Obeject Industry Co not in use" still bex it is using like. But Object is there in info cube. Query should be open on Infoset. after trnsporting i done