Authenticate and fetch data

I suppose scores of people have asked this question; and even after reading most of those threads, I still haven't been completely successful.
Here's my query:
I'm trying to write an application that opens an HttpURLConnection, fills the login and password on a form, and upon submitting the form, the server returns a data(.exe) file which has to be fetched.
My code pasted below works on my own company's website (i.e. authenticates me and fetches the redirected html page content after that).
However the site for which the application is meant for, returns the same initial logon page after execution, instead of the .exe file.
Here's my code:
===========================================================
package authhttpdatadownload;
import java.io.*;
import java.net.*;
import java.nio.charset.CharsetEncoder;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class AuthHTTPDataDownload {   
    public static void main(String[] args) {
       String localFilePath = new String("C:/Temp/0929.exe");
       String urlHost = new String("http://www.somesite.com");
       String urlUserName = new String("user1");
       String pwd = new String("pass1");
       String urlPath = new String("http://www.somesite.com//logon.aspx?ReturnUrl=%2fdata%2f0929.exe");
        try {
            String postData="txtUserName="+URLEncoder.encode(urlUserName,"UTF-8");
            postData+="&"+"password="+URLEncoder.encode(pwd,"UTF-8");
            FileOutputStream fos = new FileOutputStream(localFilePath);
            DataOutputStream dos = new DataOutputStream(new FileOutputStream(localFilePath));
            URL url = new URL(urlPath);
            HttpURLConnection huc = (HttpURLConnection) url.openConnection();
            huc.setDoInput(true);
            huc.setDoOutput(true);
            huc.setUseCaches (false);
            huc.setRequestMethod("POST");
            huc.setFollowRedirects(true);
            OutputStreamWriter osw = new OutputStreamWriter(new BufferedOutputStream(huc.getOutputStream()));
            osw.write(postData);
            osw.flush();
            osw.close();
            BufferedReader buffer = new BufferedReader(new InputStreamReader(huc.getInputStream()));
            String idata;
            while ((idata=buffer.readLine()) != null) {
                dos.writeBytes(idata);
            buffer.close();
            dos.close();
            fos.close();
            huc.disconnect();
        catch (Exception ex) {
            System.out.println("Exception - " + ex.getMessage());
}==========================================================
Here's the relevant part of the form on the logon page:
<form name="frmLogon" method="post" action="logon.aspx?ReturnUrl=%2fdata%2f0929.exe" id="frmLogon">
<input type="hidden" name="__VIEWSTATE" value="dDwxMzEyNjgwNzE0Ozs+8RfeXl1eee5WsfphofQJZlmlIDc=" />
               <table WIDTH="90%" cellpadding="0" cellpadding="0" border="0">
                    <tr>
                         <td>
                              <h1>Login</h1>
                              <table>
                                   <tr>
                                        <td Width="110px" align="left">
                                             <span id="lblUserName">User Name : </span>
                                        </td>
                                        <td width="260px" align="center">
                                             <input name="txtUserName" type="text" id="txtUserName" />
                                        </td>
                                   </tr>
                                   <tr>
                                        <td Width="110px" align="left">
                                             <span id="lblPassword">Password :</span>
                                        </td>
                                        <td width="260px" align="center">
                                             <input name="txtPassword" type="password" id="txtPassword" />
                                        </td>
                                   </tr>
                                   <tr>
                                        <td Width="110px" align="left">
                                        </td>
                                        <td width="260px" align="center" valign="middle" height="32px">
                                             <input type="submit" name="btnLogon" value="Log On" id="btnLogon" />
                                        </td>
                                   </tr>
                                   <tr>
                                        <td colspan="2" align="center">
                                             <span id="lblError"><font color="Red"></font></span>
                                        </td>
                                   </tr>
                              </table>===================================================
what I've noticed is a hidden input field on the form what looks like a randomly-generated value by the server on this form. Is this the reason why my program cannot authenticate to the server in this case?(in the other case where it works, the form doesn't have a hidden field) If yes, then given the form above, how could this be achieved? Any suggessions would be much appreciated.
Thanks!
-nitin
===================================================

If you have a model and needs to refresh the data, do not reinstantiate the model with new data. Add a set method to your model as such:
public void setData(Object data)
  // Set internal variables as necessary
fireTableDataChanged();
}Otherwise, you have new objects being created, the table has to readjust its listeners, etc. That's extra overhead that is not necessary.

Similar Messages

  • Simple Count query and fetching data

    Hello,
    I have a table Emp :
    Name, age, sal, dateUpdated
    A 21 100 6/4/10
    B 21 101 6/4/10
    C 32 101 2/2/2
    D 20 100 3/3/3
    I am trying to count the number of people in the same age group AND fetch that number.
    For ex, I want to count the number of people that were updated today and then fetch their age.
    for ex : something like this : select count(dateUpdated) from Emp where date updated is today
    will only return 2 as result.
    how should my query be if I want to even fetch the individual age along with the count ?
    cheers,

    You can use {noformat}{noformat} tags to preserve your code format. That would help every one to read your post better.                                                                                                                                                                                                                                                           

  • Can we change/Modify BI server generated Sql query and run to fetch data

    Hi,
    My client is saying that there is an option to modify bi server generated sql query to fetch data from source.
    question:As a request is made in presentation services, A dynamic sql query is generated and fetches data from source. all this is loggedin Nqlquery log..well can we change/modify the sql query generated and run modified sql query to fetch data from source. ., if so how? if not why?
    Thanks in advance
    Edited by: user10794468 on Jun 16, 2009 6:29 PM
    Edited by: user10794468 on Aug 12, 2009 6:58 PM

    Thank you so much for your reply..
    ..Can we also modify sql query generated by bi server to fetech data. the query's which we see in query log file..

  • Unable to fetch data in embedded Xcelsius PDF file on disconnected system

    I have an Xcelsius 2008 document with QaaWS. I am able to export it to the PDF and fetch data using QaaWS.
    I would like to know, it is possible for the embedded Xcelsius file in PDF to fetch data when the PDF file is sent to customers outside the network.
    We are using Business Objects XI 3.1, Xcelsius 2008, QaaWS, MS SQL Server 2008
    Thanks in advance.

    Hi,
    When you send the PDF file for the dashboard you have created in Xcelsius, it takes it with the data available in embeded excel.  You need not send the data separetly with the PDF.
    However, if the data changes, you need to save the dashboard again in PDF format and send it to the user community.
    Hope I answered your question.
    Regards,
    Rashmi

  • How to fetch data from CDHDR Table based on Order Number

    Hi,
    I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
                 WA_CDHDR LIKE LINE OF IT_CDHDR,
                 S_OBJECT1 LIKE CDHDR-OBJECTID.
    CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.

    P838355 wrote:>
    > Hi,
    >  I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    >
    > HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    >
    >
    > PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    >
    > DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
    >              WA_CDHDR LIKE LINE OF IT_CDHDR,
    >              S_OBJECT1 LIKE CDHDR-OBJECTID.
    >
    > CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    >
    > SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.
    You need to loop through the select option and concatenate with required data then select using 'in' instead of equal or select one by one.
    or
    select sales order numbers from VBAK for the selection into internal table then loop through the internal table and concatenate then select from CDHDR.
    for better performance use objectclass in where clause. the value for sales order for objectclass is VERKBELEG.
    in my system the object id is just an order number there is no other additions to it but in CDPOS the tabkey contains the order number with client and other information also.
    the 30 may be your item number... check it
    go ahead and change sales order and see what you can find in CDHDR
    Good luck
    Edited by: Sampath Kumar on Oct 21, 2009 9:02 AM

  • How to fetch data in a grid format in a bean area in forms 6i?

    Hi,
    I need help from all the gurus and experienced persons in forms 6i. I am trying to build form which will have some text fields and a bean area which will display the records that I had entered. Basically following is the basic form structure I am trying to develop
    1. There will be a search form which will have two text fields 'Emp ID' and 'Emp Name' and two buttons 'New' and 'Find'.
    2. Let there be another form which will have a bean area which will display the following columns in it in the form of a GRID
    a. Emp ID
    b. Emp Name
    This form will also have two text fields 'Emp ID' and 'Emp Name'.
    3. When I press 'New' in the search form then the second form should open and it will be blank. I can enter data in the text fields and save the form. The grid area (bean area) should be blank.
    4. When I open the search form again and enter the 'Emp Id' I just created in the above step and click the 'Find' button then the next form should open and the 'Emp Id' and the 'Emp Name' text fields should be populated with the data I created in the step 3 and the bean area should also display the record in the form of a grid.
    I am ok with all the parts except for the bean area part. Can you help me hpw to develop the form with the bean area and fetch data when searched for and display it in the form of grid?

    But still I would like to learn about the Bean being used in the Oracle Forms. I am not familiar with Java at all. So it would be very helpful from your side if you can give me some sample on how to use bean area in forms and fetch records in that in the form of a Grid.You don't need to know anything about Java in order to implement a Java Bean in your form. You simply need to know how Oracle Forms interacts with Java Beans and the When-Custom-Event trigger used to interact with Java Beans.
    Francois Degrelle has a great web site (Oracle Forms PJCs/Java Beans) for learning how to use Java in Forms. I recommend you get started here. The biggest hurdle you will encounter is setting up your App Server or your local Forms Builder installation to use Java Beans. For some reason, Oracle has retired many of the documents on OTN that walked you through this setup. However, I can assume that you have access to My Oracle Support (MOS) since you are working with EBS 11.5.9. You should be able to find everything you need in MOS to help you set up your environment.
    Craig...

  • Suggestion on using SwingThreads to fetch data with Stateless Sessin Beans

    Hi,
    I have developed a GUI application using Swing.
    Using this GUI user will be able to view data (Tabular representation)fetched from database using Stateless session beans. In the application there will be two tabs and data should be fetched based on filtering parameters like Id which is a combo box. So if the user changes the comboBox selection, the data should be updated in two tabs irrespective of current tab focus.
    Currently I'have not used any Threading concept while fetching data. I have made calls based on Tab focus. But plans to use SwingThread SwingUtilities class. But it has problems of asychronous communication. So if anyone has faced problems using swing thread for doing database access using stateless session beans can throw somelight on this to avoid problems which may come later.
    In simpler terms using Swing threads have to make two or three EJB calls and fetch data from database and update the Table data.
    Thanks.

    Your user response time should not necessarily increase. You could load your data for the selected tab first and update the display after each response. This is simply showing information as soon as it becomes available rather than waiting for the entire operation (2 remote calls) to complete.
    If you use 2 Threads you might get this anyway but should ensure that your EJB calls happen in parallel otherwise you should work out the best order for them yourself.
    I'm not sure I'd say that you'd get synchronisation issues. You might get data issues whereby, as you rightly say, one of your calls returns an error. This shouldn't cause too many problems but you will need to make sure you've got suitable error-handling code and the ability to convey errors to the user.
    Personally, if the calls were dependent on each other I'd make them one after another in the same Thread rather than trying to coordinate two concurrent remote calls.
    If you're worried about the overhead of two remote calls in series then you can always expose another stateless session bean method that will perform both calls (or however many you want) for you in one remote call, thereby cutting down the overhead and simplifying your client development.
    Hope this helps.

  • Query on fetching the no.of days between Invoice date and due date in rtf template embedded BI Publisher Report

    Hi Experts,
    We have a requirement to fetch the value of 'No of days' between Invoice date and due date (Two variable date fields on the template) in an Analysis.
    Please let me know the procedure of how to achieve the same.
    Regards,
    Rev

    it's good for ideas but implementation a bit different
    Oracle Business Intelligence Publisher Report Designer's Guide
    This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
    <?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
    where
    format is the time value for which the difference is to be calculated
    Example:
    <?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
    returns
    -7

  • Fetching data from a table and displaying it on the text box

    Hi,
    I have created a dialog program in which created a container(text box)  to enter data upto 1000 characters.
    Iam capturing the data and storing it in a custom table. In PBO I want to fetch data from my custom table (if data is already present :1000 characters data) and display it on screen.
    Please let me know how do i do it?

    hii Pavani,
    declare this two sttements in Screen
    MODULE STATUS_DATA.
    MODULE SELECT_DATA.
    In PBO, Under SELECT_DATA write Select query like:
    (considering the DB field to be text and Screen Field to be SC_TEXT)
    select text from <DB Table> into SC_TEXT where <condition>.
    *note if u r selecting more than one field than write fields in (   ),eg. (f1....f2) )
    Plz let me know for  any further queries.
    Regards,
    Apoorv

  • Sales and Billing data is not fetching in case of STO

    Hi
    We have  tables VBAK and VBAP - sale oder 
                                    VBRK and VBRP - Billing data
    Now problem is that I want to make a BW datasource in ECC in which i create view from which we need to populate data for order and billing together but we are facing problem in case of STO where billing doc canu2019t be create against with Sale order doc
    Suppose, If I create a view from which all record regarding order and Billing are coming from table VBAK,VBAP,VBRK and VBAP then we have got record  but in case of STO where billing doc canu2019t be created with against of Sale order then we have failed to find the record against sales doc because view fetch data depend upon intersection functionality.
    We need sales data in case of STO also. please give the helpful for the same.
    Thanks & Regards,
    Gourav Sekhri

    Hi Krishanan
    I am facing the same problem which have been mentioned by you (i am not getting sales doc data for normal sales orders if billing document is not yet created, which might not be desirable in my scenario).
    I have also created generic extractor based on view(all data only for sales order) and also creating append structure for all field based on billing data.
    but now i am facing the problem in which i need to take VBRK table data based on sales doc but in VBRK table sale doc is not defined.
    kindly look into the matter and give the helpful reply.
    Thanks & Regards,
    Gourav Sekhri

  • How to fetch APPROVER NAME  and approval date dynamically for an user

    Hi all..
    How to fetch approver name and approval date dynamicall for an user in an email template..
    can any help me to sort out this pbm,i am new to IDM..
    Thanks in advance..

    Access policies get a static value.  You can't populate a field with an adapter.  If you must do this, leave the field blank, and put an adapter on the process form for your field that must be populated using code or logic.
    -Kevin

  • How to fetch data from XML and store it in internal table

    Hi All,
    Can anyone help me out, in fetching data from xml and store it in an internal table. Is there any standard function module is there?
    Regards,
    Karthick

    to do this you can either develop a XSLT program and use it with CALL TRNSFORMATION key word to tranform the XML into itab .
    (search the ABAP General forum, i have posted few samples)
    or simply use the following FM which converts your XML into a itab of name value pair (name would holw the element name and value would hold the value of the element) which you can then loop and read it to your itb.
    data:             xmldata type xstring .
    data: result_xml type standard table of smum_xmltb .
    data: return type standard table of bapiret2 .
    CALL FUNCTION 'SMUM_XML_PARSE'
      EXPORTING
        xml_input       = xmldata
      TABLES
        xml_table       = result_xml
        return          = return .
    Regards
    Raja

  • How to Fetch Data From Standard Table MARA and Display using BOPF ?

    Hello All,
    In BOPF creation of Quey to a node fetches data from the Data Base Table attached to that Node,
    But in my requirement I have to fetch data Present in a Standard table and Display it in the FPM List Using FBI.
    **  Can we Fetch the data From Standard Table and fill the Node in BOPF, Is this possible as the standard Table do not contain KEY field which BOPF uses for Data Fetching ?
    Kindly share your Idea's .
    Thanks in Adv.

    Hi Dhivya,
    Thanks For your Response.
    In my Requirement I want to make ROOT Node as Transient Node.
    When I create a Sub Node to a Root Node, I am able to get this option to make this sub node as a Transient Node .
    By selecting   'Standard<-->Extended' option in the Menu item 'GoTo' I am able to get this Transient Node check box field for the Sub Nodes.
    I want to make a ROOT Node as a Transient Node.
    (Which Version you are using, and which transaction you are using to create BO . we are using BOBX Transaction, Version Ehp 6 )
    Kindly Guide me .
    Thanks,
    Kranthi Kumar.

  • HOW TO STORE FETCH DATA IN TEMP TABLE AND HOW CAN I USE THAT FURTHER

    I WANT TO STORE THIS FETCH DATA IN  SUM VALUE IN TEMP TABLE THEN I WANT TO USE THIS VALUE IN ANOTHER
    CODING. HELP ME TO DO THIS?
    SELECT SUM(SIGNEDDATA) 
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!=''))

    If you want assign to variable:
    DECLARE @SUMAMOUNT INT - -you may change the datatype as required
    Set @SUMAMOUNT = (SELECT SUM(SIGNEDDATA) 
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!='')))
    And you can use @SUMAMOUNT for further processing
    If you want to store it in a table 
    SELECT SUM(SIGNEDDATA)  as SUMAMOUNT into #Temp
    FROM FACPLAN
    WHERE TIMEID IN
    (SELECT TIMEID FROM Time 
    WHERE ID IN
    (SELECT CURRENT_MONTH FROM mbrVERSION WHERE CURRENT_MONTH!=''))

  • How i avoid this window and directly fetched date

    hi master
    sir i have three options button when i select anyone then my query change and fatch new data
    but before fetching data system show new windows with this message
    Do you want to save the changes you have made ?
    with yes / no /cancel button
    sir how i avoid this window and directly fetched date
    or how bypass this message
    please give me idea

    bro, when u execute the query to fetch records it tries to validate the form and pops an alert message. if u want to avoid it do this
    change : execute_query;
    to: execute_query(no_validate);
    now it wont ask for validation of the previous records present on the form, but make sure such actions are not not a threat to data integrity.
    zaibi.

Maybe you are looking for

  • SAP report print formats

    Hi! There are several report print formats in an ABAP report. You can choose between them during printing, some examples: X_65_80 (80 columns, 65 lines), X_90_120 (120 columns, 90 lines) and so on... Is there away to define more "standard" like print

  • JCoDestination Problem: JCO_ERROR_RESOURCE: Destination does not exist

    Hello Experts, I followed the JCo3 tutorial of accessing backend ABAP system. I implemented the following code: File configuration = new File(JCO_DESTINATION_APP +".jcoDestination"); if(!configuration.exists() || updateprovider) {    Properties prope

  • Comparision between ECC6  and  verson 4x

    Hi, Can anyone give me the list of additional features available in ECC 6.0 as compared to version 4.x (pertaining to MM module) In other words, comparison between ECC6.0 & 4.x (related to MM module) If it is available in pdf or ppt, please send it t

  • RP_provide_from_last  selecting wrong value ???

    Hi experts.. In my report i had used statement .. RP_provide_from_last P0027 SPACE PN-BEGDA PN-ENDA... Now on selction secreen i am giving any random pernr no. 5656 along with begda-->01011800 enda--->31129999 Although there no such data peresent for

  • USPS will not print labels using Safari

    I am forced to use Internet Explorer to print USPS labels. Safari will not open up Adobe and bring up labels for printing. Explorer brings up the label and allows it to print. Any solution to this problem out there?