HTTPUnit: submitting an online form in Java

Hi, I have a problem filling out an online form using the HttpUnit API in Java. I have a java program that opens up an IE browser and goes to the website, but when I try to send the WebRequest, the program gives me a "Connection timed out" error. Not sure what I'm missing here, I have the same coding as many other examples I've found around the web for form validation. Here is my code:
import com.meterware.httpunit.*;
import com.meterware.httpunit.cookies.CookieProperties;
import com.meterware.httpunit.cookies.CookieListener;
import com.sun.org.apache.xerces.internal.util.URI;
import java.awt.*;
import java.net.URL;
public class expertLogin
public static void main(String[] args)
try
String url = "http://fedexifc.infousa.com/QAA/demo/Login.aspx";
WebConversation wc = new WebConversation();
CookieProperties.setDomainMatchingStrict(false);
CookieProperties.setPathMatchingStrict(false);
HttpUnitOptions.setExceptionsThrownOnScriptError(false);
CookieProperties.addCookieListener(new CookieListener()
public void cookieRejected(String s, int i, String s1)
System.out.println("CookieProperties.isDomainMatchingStrict() = " + CookieProperties.isDomainMatchingStrict());
System.out.println("CookieProperties.isPathMatchingStrict() = " + CookieProperties.isPathMatchingStrict());
System.out.println("s = " + s);
System.out.println("s1 = " + s1);
System.out.println("Reason: " + i);
Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \"http://fedexifc.infousa.com/QAA/demo/Login.aspx\"");
WebRequest req = new GetMethodWebRequest("http://fedexifc.infousa.com/QAA/demo/Login.aspx");
WebResponse resp = wc.getResponse(req);
WebForm loginForm = resp.getFormWithName("form1");
String[] cookies = wc.getCookieNames();
for (int i = 0; i < cookies.length; i++)
String cooky = cookies;
System.out.println(cooky + " = " + wc.getCookieValue(cooky));
loginForm.setParameter("TextBoxUsername", username");
loginForm.setParameter("TextBoxPassword", "password");
loginForm.setParameter("TextBoxGroup", "group");
loginForm.submit();
for (int i = 0; i < cookies.length; i++)
String cooky = cookies[i];
System.out.println(cooky + " = " + wc.getCookieValue(cooky));
resp = wc.getCurrentPage();
System.out.println(resp.getText());
catch (Exception e)
e.printStackTrace();

I'll try this again. I have a problem filling out an online form using the HttpUnit API in Java. I have a java program that opens up an IE browser and goes to the website, but when I try to send the WebRequest, the program gives me a "Connection timed out" error. Not sure what I'm missing here, I have the same coding as many other examples I've found around the web for form validation. Here is my code:
import com.meterware.httpunit.*;
import com.meterware.httpunit.cookies.CookieProperties;
import com.meterware.httpunit.cookies.CookieListener;
import com.sun.org.apache.xerces.internal.util.URI;
import java.awt.*;
import java.net.URL;
public class expertLogin
public static void main(String[] args)
try
String url = "http://fedexifc.infousa.com/QAA/demo/Login.aspx";
WebConversation wc = new WebConversation();
CookieProperties.setDomainMatchingStrict(false);
CookieProperties.setPathMatchingStrict(false);
HttpUnitOptions.setExceptionsThrownOnScriptError(false);
CookieProperties.addCookieListener(new CookieListener()
public void cookieRejected(String s, int i, String s1)
System.out.println("CookieProperties.isDomainMatchingStrict() = " + CookieProperties.isDomainMatchingStrict());
System.out.println("CookieProperties.isPathMatchingStrict() = " + CookieProperties.isPathMatchingStrict());
System.out.println("s = " + s);
System.out.println("s1 = " + s1);
System.out.println("Reason: " + i);
Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \"http://fedexifc.infousa.com/QAA/demo/Login.aspx\"");
WebRequest req = new GetMethodWebRequest("http://fedexifc.infousa.com/QAA/demo/Login.aspx");
WebResponse resp = wc.getResponse(req);
WebForm loginForm = resp.getFormWithName("form1");
String[] cookies = wc.getCookieNames();
for (int i = 0; i < cookies.length; i++)
String cooky = cookies;
System.out.println(cooky + " = " + wc.getCookieValue(cooky));
loginForm.setParameter("TextBoxUsername", username");
loginForm.setParameter("TextBoxPassword", "password");
loginForm.setParameter("TextBoxGroup", "group");
loginForm.submit();
for (int i = 0; i < cookies.length; i++)
String cooky = cookies[i];
System.out.println(cooky + " = " + wc.getCookieValue(cooky));
resp = wc.getCurrentPage();
System.out.println(resp.getText());
catch (Exception e)
e.printStackTrace();
}{code}
The error message is:
{code}
java.net.ConnectException: Connection timed out: connect
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
     ...11 more
Caused by: java.net.ConnectException: Connection timed out: connect
...9 more{code}

Similar Messages

  • Filling out online forms with java

    I wanted to create a program that will fill out a form on a website by running a java program. COuld anyone tell me what i would use to make the program fill in i guess a text feild and then select a radio button and submitting the results? I tried looking through books and online but i dont even know what im looking for really.

    Maybe look for browser plugin programming. Otherwise, I don't know how a Java application (as opposed to an Applet) could ever access an HTML page in a browser window.
    At least not without going native. On Win machines, you might use something like the Java-Com bridge to access the IE's API... if it provides one and its methods help you to do what you intend.

  • How to create table in interactive form via Java Web Dynpro

    Hi,
    How to create table in interactive form via Java Web Dynpro ?
    Any online tutorial / example ?
    Thank you.
    Regards,
    Eric

    Hi Eric,
    Just choose the UI element Table from Form Library and drag and drop it on the form. now choose the no. of rows and columns and other settings you want about table from the wizard initiated through this process. This all is what you have to do to create the table. Now to bind it to the fields of the data source bind the individual colums to individual attributes of the node in the datasource.
    Hope it will solve your query.
    Regards,
    Vaibhav Tiwari.

  • Create printouts from data submitted in a form.

    Long story short:
    I'm looking to set up a system that automatically creates a document from data submitted in a form. So imagine I type "Jason" in the name field, "Orangutans" in the favorite animal field, and when I click print I'm presented with an A4/Letter document that says "my name is Jason and I love Orangutans" and the background is covered in cute orange apes. Where do I start?
    Long story long:
    I work at a computer store and due to my experience with Adobe products* I've been tasked with creating all the signage in the store. I've been doing all the signs for a year now and now we have a bunch of different signs that need printing every day. The most in-depth and time-consuming ones for me are signs for Trade-In computers. Unlike new computers, the specs are always different based on the particular model we buyback from the client. There are all kinds of fields that are different in each case.
    As it stands, I have an illustrator file with all the information in the right place, and when a computer comes in I take all the specs, fill in the right boxes and unhide the image layer so I get an image of the corresponding model on my document. This takes considerable time, and means the process is specific to me, i.e if I'm not in the store, the computers don't get put up for sale beacuse we can't add a spec/price sheet.
    What I want to do is automate the process so that anyone in the store can make these signs. All they will have to do is fill in a form (online or locally) that asks for model, year, RAM, HDD, etc**. Then when they click submit it returns a completed sign that they can print and put up next to the computer.
    I'm not entirely sure how to accomplish this. I've looked at Adobe's free online FormCreater***, and I like the simple data output that it creates. However, I'm uncertain as to my next steps. I imagine I'll need it to send the results to a computer with blank templates for the Trade-In computers. It would then need to populate the applicable fields and automate all the work I usually do.
    Where should I start? I'm willing to learn anything to get this working.
    Thanks,
    Jason
    *Illustrator, Photoshop, Flash, inDesign
    **Total of ~18 text and 4 image fields need to be changed per sign.
    ***http://www.adobe.com/ca/products/acrobat/form-creator.html

    I'm willing to learn anything to get this working.
    Excellent! Right attitude.
    Where should I start?
    With my favorite "graphics program": FileMaker Pro. (Yep. My favorite graphics-project tool is a relational database program.)
    You see, you've discovered something that graphics people are discovering with increasing frequency all the time: Your project is not a graphics problem. It's a data problem.
    Note how little of your problem has to do with graphics. Emphasis mine:
    ...we have a bunch of different signs that need printing every day.
    the specs are always different based on the particular model
    automate the process so that anyone in the store can make these signs
    All they will have to do is fill in a form (online or locally)
    an image of the corresponding model
    See if this scenario sounds appealing:
    You have on your computer a single file, named TradeIns. You or one of your authorized users doubleClick it. It opens to a nicely organized form that is completely self-explanatory; requires absolutely no training to use.
    It's completely idiot proof. The user doesn't have to know anything about any graphics program. He can't break anything.
    Consistency is maintained because everything that can be automated is. Dependency intelligence is built in. Popup menus limit data entries to legitimate choices (ex: Models). Subsequent data entry choices are automatically filtered based on data already entered (ex: RAM configurations limited to those possible for Model). User prompts and hints (highlighting, event-driven messages, tooltips, data validation, etc.) make sure that all required information is entered.
    When the data entry is done, the user clicks a button labeled Print Preview: A3 Poster. The display automatically changes to a pre-defined A3 formatted layout with all the data graphically styled (Headline, descriptive blurb, bullet list of features, price, etc., etc.), the company logo and contact info in place, and a graphic of the appropriate model appears in the background. The user clicks a button labeled Print Poster. Next to it, by the way, is a button labeled Email Poster To...
    If you want, you can enable up to five people concurrently to access and interact with the solution in their web browsers from anywhere. So the data entry can be performed by staff members who logon (according to access priviledges you define and control down to the individual field level if need be) in the office, from home, or even on their iPhone. Multiple users can enter/edit data at the same time.
    It's 2:00 Tuesday when Customer leaves with his new machine. You clean up his trade-in a little; put it on the display shelf. Pull out your iPhone and take a photo of it. Tap the specs in. The data, including the photo, are simultaneously entered into the database. You lock the door and go home at 5:00, confident that a formatted sales flier of "Just Arrived" trade-ins will be automatically emailed to your mail list before you get home.
    You, having admin priviledges, can add to, alter, elaborate upon the functionality (ex; add an automatic price calculator) anytime you need, with no downtime on the system.
    How difficult, time-consuming is this?
    Once the requirement details are nailed down, and the raw beginning data for populating values lists is provided, an intermediate level FileMaker developer could build the above-described solution and have it up and running, ready for data entry, in less than a day, easy.
    Cost? $500 for one copy of FileMaker Pro Advanced. That's it. (And...*achem*...it's not rented; it's a normal perpetual license.) And with it you can build an unlimited number of other data-driven solutions for your business. You can even bind them as fully-functional standalone applications which you can distribute without royalties.
    Based on what you've described so far, the solution's starting data schema would be very simple:
    Create a new database with three related tables:
    Models
    Trade Ins
    Specs
    The fields for each table would be something like this:
    Models
    Model ID (primary key; text; unique)
    Model Name (text)
    Brand (text)
    Image (container)
    Trade Ins
    Trade In ID (primary key; text; computer's serial number)
    Model ID (foreign key; text; value list)
    Specs
    Spec ID (auto-enter serial number)
    Model ID (foreign key)
    Trade In ID (foreign key)
    Spec Name (value list)
    Description (text)
    You'd have two Layouts (screens): Data Entry and A3 Poster. You could build as many additional Layouts to display whatever combinations of the data you want for as many purposes as you may encounter. Export to PDFs or Excel spreadsheets any time. Build automated reports with live graphs, use conditional formatting, automate with scripts, etc., etc.
    Marvelous program. Every business should have it.
    JET

  • Problem executing an Online Form in Web DynPro(Adobe Form)

    Gurus,
    I am trying to create an Online Form in Web DynPro(Adobe Form), i could successfully create the form and deploy it.
    But when i executed, i am getting the below error.
    <<
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Error during call to AdobeDocumentServer: Processing exception during a "UsageRights" operation.
    Request start time: Thu May 18 16:31:04 CEST 2006
    com.adobe.ProcessingError: Error while retrieving a password for credential: ReaderRights:
    java.lang.Exception: Could not retrieve a password for credential: ReaderRights
         at com.sap.tc.webdynpro.clientserver.adobe.AdobeFormHelper.createPDFDocumentForUIElement(AdobeFormHelper.java:420)
    >>
    Any Help would highly be appreciated
    Regards,
    Arvind Kugasia

    Hello  Markus,
    let's say I have two systems. One - X - installed J2EE+ABAP and configured WD pdfobject WS proxy to point to second system - Y - with correctly configured ADS (inculding Redaer Rights Credential). Do I have to setup this Reader Rights Credentila also on system X ?? Do I have to setup something else on system X to work with Interactive forms in WD Java on system X ?
    PS: Our ABAP calls from X to ADS on Y are working okay, but I didn't try WD ABAP as basis is too low.
    Thanx, Richard.
    Message was edited by:
            Richard Calaba

  • Handling multiple submits in single form with JSP

    HI,
    I need to handle multiple submits in single form in a JSP.
    <html>
    <body>
    <form action="/Compute" method="post">
    <input type = "Submit" value="Find"/>
    <input type = "Submit" value="Add"/>
    <input type = "Submit" value="Delete"/>
    </form>
    <body>
    <html>
    /Compute wld take the control to a servlet named ComputeController.java .
    In this servlet how should I distinguish which Submit has been clicked(Find or add or Delete).
    TIA

    Give the submit button a name. It will be sent as well, so you can see it in the request variables.

  • Online forms

    Hello everybody,
    When I try to fill out an online form for a reservation, an order, a survey etc., it works in approximately 70% of the cases. In the other 30% of the cases, the button 'conform' or 'proceed' or 'next step' doesn't work. The strange thing is: it doesn't freeze, it doesnt remove the data I filled in, just NOTHING happens. I read several discussions about Java, but that doens't seem to be the problem. Does anybody know what the problem is and how to solve it? Is it the web site, not workin properly in Safari? Is it some setting on my iMac? Is it some setting in my Intego Internet Security Pack? I would be grafetul if you could help me out!
    Regards, Arjan.

    http://web.mac.com/varkgirl/iWeb/Varkgirl/Add%20forms.html

  • Online form problem

    Hello
    I have a site (2004 MX) which houses an online form.
    When the form is completed and the submit button clicked I
    have noticed that TWO messages are sent to the Webmaster. Sometimes
    one is blank and the other completed as it ought to be.
    Is this likely to be a server script error (I am using CDO),
    or something in Action Script?
    Many thanks.
    Steve

    Hello  Markus,
    let's say I have two systems. One - X - installed J2EE+ABAP and configured WD pdfobject WS proxy to point to second system - Y - with correctly configured ADS (inculding Redaer Rights Credential). Do I have to setup this Reader Rights Credentila also on system X ?? Do I have to setup something else on system X to work with Interactive forms in WD Java on system X ?
    PS: Our ABAP calls from X to ADS on Y are working okay, but I didn't try WD ABAP as basis is too low.
    Thanx, Richard.
    Message was edited by:
            Richard Calaba

  • Is there a save function for online forms?

    Hi, I've created an online form which requests quite a lot of information from those who it is sent to.  Because of its size, I have made use of the skip logic rules to so that users can quickly skip sections that don't apply to them.  Notwithstanding this, the form asks questions which users may need to reseach and come back to so it wouldbe really useful if the form had a save function.  Does anyone know if such a function exists and if not, whether there are there imminent plans to develope one?
    If not, regreattably I will have to try and find another solution for online information gather that has a save and return function.

    hi randy
    I wholely support the request for a save feature for online forms, any idea of an ETA for this?
    Also to expand on this- the ability to print the  web form would be brillant.
    a few options for the  web forms submit to print, save.
    Web forms after/before  submission maybe to save as a pdf locally -  which then could be printed out.

  • "Access Denied" pop up error while opening adobe online form in IE8.

    "Access Denied" pop up error while opening adobe online form in IE8. I use crosslink to connect to client network and then open IE with App Tunnel. Tried to re-install Acrobat reader multiple times but issue still persist. Even tried to change the PDF properties (Edit-> Preference- General/Internet/Security Enhanced)

    Hello Adobe technical Team,
    I am struggling to fix the issue. Tried a lot of combinations to manipulate PDF preference, browser setting but failed to fix the issue. Can someone please look into the details and advise? Thanks in advance for any help.input.

  • Online form... is there a way to do this?

    My company's website has been using formGenie for several years to process our online forms.
    http://www.form-genie.com
    I initially began using their script to process our online application located here:
    http://www.escswa.org/Application.pdf
    formGenie solved my issue several years ago, in that it allows you to create a form, then using a few hidden fields and a simple script file, you can transmit the form to an email address where it will open the information back up in the same online pdf form so that it looks like the "filled out form" on the receiving end as well. This worked well for my employer who just wanted to be able to print the online application once she got it (and wanted it to look like our application instead of a string of data).
    In the past couple of years we have started having issues with the form. Our biggest is that people on Mac computers can't submit the form most of the time. I am needing to create a lot of forms this month and wanted to see if there are other options available now. I use CS3... is there a way that I can create and process my own form online - so that it will visually look like the actual form when received by an email address and opened?
    Andi

    When you create a form in FormsCentral you can set up the option to recieve email notifications (with the option to include the responses in the email).  You can save/distribute the form as a PDF and when the user clicks the "Submit" button the data is collected in FormsCentral and the notification is sent to you. 
    If you wanted to have the actual PDF emailed to you that is not currently supported using the FormsCentral data collection PDF but you could create the form in FormsCentral and save a PDF that is not enabled to collect data (from the Design Tab clicking "File - Save as PDF form" will save a PDF without the Submit button) you could then modify the PDF in Acrobat adding your own Submit button that would email the PDF back to you.
    Thanks,
    Josh

  • I have a online form created with my paid account that has just stopped working.

    I have a online form created with my paid account that has been working for months that just started displaying a message that starts "This form was easily created for FREE with FormsCentral. See how..." The inline frame that it shows up in has also changed to be very small. The form is set to open in FormsCentral and shows the message and inline frame size when I choose preview. What's up?

    Checked when I got back in to work today and everything is working as it should. All of our online forms were screwed up yesterday, but are working this morning. I know this won't help anyone in the future, but just wanted to follow-up.

  • How to use MICR fonts in Adobe forms (webdynpro java

    Hi,
          We have a requirement where we need to print some MICR codes (for checks) through Adobe Forms.
    I have installed some true type MICR fonts in windows and Adobe Font Manager (in ADS) as well.
    It is visible in the Adobe Form design time (Font palette) and when I use the font for text, it is visible in preview too. But when I run the web dynpro application, in the online form it is converted into Standard font (Times new Roman).
    Is there anyway to handle this issue.
    Please let me know.
    I am using NWDS 7.0.1
    Adobe Live cycle designer 7.1
    SAP NW 2004s SP14
    Thank you,
    Vasu

    Check this forum post (though that is for 6i, it would be of helpful for you)
    How to use unicode fonts in Oracle forms 10g?
    -Arun

  • How do I reset responses (and summary report data) and use my online form for a new application?

    I created my online form, distributed it and captured the responses - worked well.  Now I want to use the same form and start over (track the responses separately from the first time). How do I reset the results / responses? Thanks for any help you provide. 

    Go to the My Forms tab on the main dashboard (were all of your forms are listed). Select your form and hit the duplicate button. This will make a copy of your form and you have the option to include or not include the responses in the copy.
    Randy

  • How can I change the behavior of the Green Enter button when filling out a field in a form? Current it submits the entire form, I would like it to tab to the next field instead

    When using Firefox for Andriod:
    When filling out a field on a form, they keyboard has a Green Enter button that submits the entire form. However, there are multiple fields on the page, and I would like it to tab to the next field. At the very least not submit the form.
    Also, is there a way to configure the keyboard that shows up for each html5 input type?

    They keyboard that shows up has the large "Green Enter" go button, a backspace and some arrow keys, but no tab button.

Maybe you are looking for

  • Data Federator - View Data in DF

    Hi, Can we view data in Data Federator if data source is SAP BW

  • Connect to iTunes with iOS7 for "Push" notifications

    Since updating to iOS7, every time I start Gmail and other programs I get this type error message. I cannot find iTunes on the phone and I also there is no selection for "push" for Gmail, only "Fetch"and manual. Any ideas?

  • Library issues with Windows 7 (64 Bit)

    I have just upgraded to a new computer and have had enormous issues with I tunes 64 bit for Windows 7. I had my music on another disc which I have mounted into the new computer. It is the same drive name (D) as on my old computer (Windows XP 32 bit).

  • VGA vs DVI

    So, which is better VGA or DVI? Can I connect the iMac (20") to a 26" LCD monitor or not?

  • EL expression not rendering

    When using jsf 1.1_01, I have an EL expression like bean1.bean2.property where bean2 is null on initial page rendering and is not rendered, as expected. When back-posting, my application actually provides a value for bean1.bean2 and so I would expect