How to parse a specific inner element using SAX

I would like to parse the values of <data> and store them but only the <data> values whose parent element is <process-type>.
My xml file looks something like:
<process-type id="IASPT" module-id="IASPT" working-dir="/apps/ora10G5/iaspt/bin">
     <port id="ajp" range="7501-7600"/>
     <process-set id="IASPT" numprocs="1"/>
</process-type>
<category id="stop-parameters">
      <data id="java-options" value="-Djava.awt.headless=true"/>
</category>
<process-type id="claimservices" module-id="OC4J" status="enabled">
     <environment>
           <variable id="DOCUMENTUM" value="/apps/dctmdev"/>
     </environment>
     <module-data>
           <category id="start-parameters">
                 <data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/claimservices/config/java2.policy"/>
           </category>
     </module-data>
</process-type>
<process-type id="ASG" module-id="custom">
      <process-set id="ASG" numprocs="1">
         <module-data>
            <category id="start-parameters">
               <data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/sharedservices/config/java2.policy"/>
            </category>
         </module-data>
      </process-set>
</process-type>
......I would like to read the value(s) of data which is within process-type. In this case:
<data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/claimservices/config/java2.policy"/>
<data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/sharedservices/config/java2.policy"/>I can read the elements, attributes and their values using SAX. The problem however is that when I read the file, it reads in not only the line I am interested in but also any <data> element within the XML file which is not what I want. I tried editing my code but it doesn't seem to work.
The start element in my code looks like this:
public void startElement(String name, String localName,
               String qName, Attributes attr) throws SAXException {
          String processTypeId = "";
          String processTypeData = "";
          if (localName.equalsIgnoreCase("process-type")){
               if (attr.getLocalName(0).equals("id")){
                    processTypeId = attr.getValue(0);
                    System.out.println("process_type/id: " + processTypeId);
          if (localName.equalsIgnoreCase("data")){
               if (attr.getLocalName(1).equals("value")){
                    processTypeData = attr.getValue(1);
                    System.out.println("data/id: " + processTypeData);
} Considering I have more than one process-type and that the first attribute of <data>, id, is the same for both, I should somehow tell SAX:
1) Find process-type element
2) Read its id attribute
3) Read <data> element and its attributes under process-type if any
4) Store <data> and attributes of each process-type (into possibly a map in the form of {process-type id, data value} pair??)
I would appreciate your help with this very much.

I thought the same. The good thing is that the first one is the one I want. The bad thing is that the first one might not necessarily be positioned at the top.
What I mean is when I read this part of the XML file
<process-type id="home" module-id="OC4J" status="enabled">
     <module-data>
           <category id="start-parameters">
                   <data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy"/>
           </category>
           <category id="stop-parameters">
                   <data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy"/>
           </category>
     </module-data>
</process-type>I am interested in the value attribute of the <data> under <category> whose id attribute is "start-parameters". The thing is that the "start-parameters" and the "stop-parameters" postions could be switched so I cannot rely on the fact that my code reads the first one successfully.
I tried editing my code like shown below but no luck
if (localName.equalsIgnoreCase("process-type")){
               //Extracting process-type attribute id
               if (attr.getLocalName(0).equals("id")){
                    processTypeId = attr.getValue(0);
                    System.out.println("\nprocess_type/id: " + processTypeId);
          if (localName.equalsIgnoreCase("category")){
               //Extracting process-type attribute id
               if (attr.getLocalName(0).equals("id")){
                    categoryId = attr.getValue(0);
                    if (categoryId.equals("start-parameters")){
                         //System.out.println("\ncategory/id: " + categoryId);     
                         categoryStartParameters = categoryId;
                         startOfCategoryId = true;
          if (localName.equalsIgnoreCase("data")){
               if (endOfProcessType){
                    if (startOfCategoryId /*&& (categoryStartParameters.equals("start-parameters"))*/){
                         if (attr.getLocalName(1).equals("value")){
                              processTypeData = attr.getValue(1);
                              System.out.println("\ndata/id: " + processTypeData);
                              endOfProcessType = false;
     public void endElement(String uri, String localName, String qName) throws SAXException {
          if( localName.equalsIgnoreCase("process-type") ) {
              endOfProcessType = true;
......Isn't there a more straightforward way to reading all the elements under a particular element in SAX?
Please assume that all the variables are defined and initialised.

Similar Messages

  • Read any XML File Elements using SAX Parser in J2se

    Hi All
    I can able to parsed one structured XML file using SAX
    Sample code :
    // ===========================================================
         // SAX DocumentHandler methods
         // ===========================================================
         public void startDocument() throws SAXException {
              logger.info("Start of document");
         public void endDocument() throws SAXException {
              logger.info("End of document");
         public void startElement(String namespaceURI, String localName, // local
                   // name
                   String qualName, // qualified name
                   Attributes attrs) throws SAXException {
              elemName = new String(localName); // element name
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_START;
              // Set the string for accumulating the text in a tag to empty
              elemChars = "";
              // If the element name is "row", create a new row instance
              // If the element is "indexxid", "ModelPrice", or "ModelSpread",
              // the value will be read in the method "characters" and stored.
              if (elemName.equals("row")) {
                   row = new IndexRow();
                   numRows++;
              // logger.info("Number of numRow:"+numRows);
         } // end method startElement
         public void endElement(String namespaceURI, String simpleName, // simple
                   // name
                   String qualName // qualified name
         ) throws SAXException {
              elemName = new String(simpleName);
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_END;
              String indexId = new String();
              Double dblVal = new Double(0);
              // If element name is "row", put the current row in the map for row
              // instances
              if (elemName.equals("row")) {
                   if (numRows <= 5) { logger.info("Row is: " + row.toString()); }
                   //ABX
                   //indexRows.put(row.getIndexxId(), row);
                   if (family.equals("ABX.HE")){
                   indexRows.put(row.getIndexREDId(), row);
                   else {
                        //CDX ITRXX
                             indexRows.put(row.getIndexxId(), row);
              } else if (elemName.equals("IndexID")) {
                   row.setIndexxId(elemChars);
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setCompositeSpread(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("REDCode")) {
                   row.setRedCode(elemChars);
              else if (elemName.equals("Name")) {
                   row.setRowName(elemChars);
              } else if (elemName.equals("Series")) {
                   row.setSeries(elemChars);
              } else if (elemName.equals("Version")) {
                   row.setVersion(elemChars);
              } else if (elemName.equals("Term")) {
                   row.setTerm(elemChars);
              } else if (elemName.equals("Maturity")) {
                   row.setMaturity(elemChars);
              } else if (elemName.equals("OnTheRun")) {
                   row.setOnTheRun(elemChars);
              } else if (elemName.equals("Date")) {
                   row.setRowDate(elemChars);
              } else if (elemName.equals("Depth")) {
                   row.setDepth(elemChars);
              else if (elemName.equals("Heat")) {
                   // logger.info("Chars for element " + elemName + " are '" +
                   // elemChars + "'");
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setHeat(dblVal);
                        indexId = row.getIndexxId();
    //          ABX.HE
              else if (elemName.equals("IndexREDId")){
                   row.setIndexREDId(elemChars);
              else if (elemName.equals("Coupon")){
                   row.setCoupon(elemChars);
              if (elemName.equals("Ontherun")) {
                   row.setOnTheRun(elemChars);
         } // end method endElement
         public void characters(char buf[], int offset, int len) throws SAXException {
              // If at end of element, there will be no characters
              if (tagPosition == TAG_END) {
                   return;
              // The characteres method may be called more than once
              // for an element if the internal buffer fills up.
              // Append the characters until the end of the element.
              String strVal = new String(buf, offset, len);
              elemChars = elemChars + strVal;
         } // end method characters
    } // end class MarkItIndexLoader
    but the problem is i want to read (parse) any XML file means any Elemets would be change any time using SAX .In the above example
    else if (elemName.equals("Heat")) {
    else if (elemName.equals("IndexREDId")){
    } else if (elemName.equals("Maturity")) {
    like above I am doing hard code Elements names and reading the values so i don't want hard coding the elements names I want to read any element name and value dynamically.
    If i give any one below XML file i want to read the Elements and displaying to console without changing any code i want to read the XML document.
    EX:
    Student.XML: <root>..</StName>..</StAge>...</root>
    Employee.XML: <root>..</EmpName>..</EmpAge>...</root>
    CdCatalog.XML: <root>..</Cdtitle>...</CdNumber>...</root>
    I need one java program can ready any type of XML file elements and send to the Database table.
    Please any one done like this task please suggest some reference links or books or sample snippet which can help me to develop program in my requirement.
    Thanks in advance
    Regards
    satish

    You should ask in the Java forum.
    Regards
    Stefan

  • How to find length of integer elements using message mapping

    Hi all,
             How can I find the number of digits in an element using message mapping
    XIer

    Satish,
               Cause I have to write the code for 100 elements, I have decided to have a AUDF with two inputs;
    1) for the element
    2) for the length of the data type (I am passing length using Constant message mapping func).
    Now when I change my UDF and try running it I get the following error:
    <b><i>Start of test
    Source code has syntax error:  /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:160: operator >= cannot be applied to int,java.lang.String if(Element_Name.length()>=Element_Length) ^ /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:166: operator <= cannot be applied to int,java.lang.String for(int i=Element_Name.length();i<=Element_Length;i++) ^ 2 errors</i></b>
    The code I have used is:
    public String Include_Space(String Element_Name,String Element_Length,Container container)
    {StringBuffer sb= new StringBuffer();
    if(Element_Name.length()>=Element_Length)
    return""Element_Name"";
    else
    for(int i=Element_Name.length();i<=Element_Length;i++)
    if(i==Element_Name.length())
    sb.append(Element_Name);
    else
    sb.append(" ");
    return ""sb.toString()"";
    Pls advice, where I am going wrong...
    XIer
    Message was edited by:
            XIer

  • Edit / Modify an XML Element using SAX.

    My need is to read,update,delete elements from large (200-700MB) xml files. Because of large files I am using SAX parser. I am able to read the xml using events generated but the issue is how do I modify a perticular attribute or node value, add new node??
    Apart from SAX is there any other better solution???
    Any help wil be appreciated!!

    if you meant "in a simple and quick way that will only change the desired value in the text file" i fear no, you can't

  • Digitally Signing specific SOAP elements using Java Mapping

    Hello SDNers,
    Iu2019m having trouble creating java mappings to sign and verify digital signatures.  Iu2019m new to Java so this is proving difficult.  I understand the basic concepts of OO programming and utilizing classes/objects to build the program, but Iu2019m having trouble with the conceptual understanding of how I would like to get this done.
    I have outbound and inbound messages.  The outbound messages are originating from an ECC backend.  The messages are processed through PI with a basic Message Mapping, then it is wrapped in a SOAP envelope with specific information using a XSL mapping and then I would like to use a Java Mapping to Digitally Sign specific portions of the entire message; specifically around an element in the SOAP header and sign the SOAP body.  I also need to verify these sections for all inbound messages.
    The simple pseudo code I have for the outbound messages is as follows:
    <ol>
    <li>1. read in xml (file input stream)</li>
    <li>2. find the (specific information)</li>
    <ol>
    <li>a. assign that string to a variable</li>
    <li>b. sign this variable with the security profile (keystore, private key)</li>
    <li>c. e-write the variable into the main xml file</li>
    </ol>
    <li>3. find the soap body</li>
    <ol>
    <li>a. assign that string to a variable</li>
    <li>b. sign this variable with the security profile (keystore, private key)</li>
    <li>c. re-write the variable into the main xml file</li>
    </ol>
    <li>4. write the output file with both variables written (file output stream)</li>
    </ol>
    Currently Iu2019m using PI 7.1 so there is no more Visual Administrator tool.
    Iu2019ve seen the examples from the last link, but I canu2019t seem to put it together when mixed with basic java mapping example.  I have been searching the SDN forums for a while now, but hereu2019s my specific question:  how do you create a java mapping to sign and verify specific elements of a SOAP message?
    Thanks in advance,
    Jason

    Hi Jason, did you ever architect a solution for this?

  • HOw to check for the Child Elements USing only SAX Parsr?

    HI Guyz,
    How to check whether there are any Child Elements in an XML file using ONLY SAX parser ??? I have a requirement of checking first whether there is any Child Elements exists for a Element or not and based on that I have to take certain actions. Can anyone suggest me How to do that ???
    Thanx
    KK

    Since SAX is event controlled, you wont know if there's a child element unless you actually bump into it with the Parser. You'll simply get another startElement event after your current one.
    /Tom

  • Collaboration Services: How does specify a specific language to use?

    Does anyone know how to administer the Leopard server in English, but have the collaboration services (wiki, blog, calendar, etc) run under another language, perhaps even specific to the User and/or Group?
    (formerly posted in the wrong forum)

    I just stumbled upon the solution.
    Checking the collaborative services pages (wiki, blog, etc.) on an English system will show the pages in English. If you use a computer with another system language, that the pages render according to the primary system language. So if you're using a Japanese system, Safari will bring up the collaborative services in Japanese.

  • How to get a specific tag value from SAX parser

    I am using the SAX method to parse my xml file.
    My Question is how to get the returning characters parsed after calling?
    esp the value of <body> tag?
    Here is my xml file, and i want to get the parsed <body> value after call sax parser.
    <?xml version="1.0" encoding="UTF-8"?>
    <article>
    <content>
    <title>floraaaaa</title>
    <date>2004-03-19</date>
    <body>
    Details of an article, and i want to get the article details
    </body>
    </content>
    </article>

    here is the parser code I am using:
    import java.io.*;
    import org.apache.xerces.parsers.SAXParser;
    import org.xml.sax.Attributes;
    import org.xml.sax.ContentHandler;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.Locator;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.XMLReaderFactory;
    public class test2 {
         public String m_xmlDetail;
         public void readDetail(String url) {
              System.out.println("Parsing XML File: " + url + "\n\n");
              try {
                   XMLReader parser = new SAXParser();
                   ContentHandler contentHandler = new MyContentHandler();
                   parser.setContentHandler(contentHandler);
                   parser.parse(url);
              } //try ends here
              catch (IOException e) {
                   System.out.println("Error reading URI: " + e.getMessage());
              } //catch ends here
              catch (SAXException e) {
                   System.out.println("Error in parsing: " + e.getMessage());
              } //catch ends here
         } //function
    }//close class
    public class MyContentHandler implements ContentHandler {
         private Locator locator;
         //public String m_bodyDetail=new String();
         public void setDocumentLocator(Locator locator) {
              System.out.println(" * setDocumentLocator() called");
              this.locator = locator;
         public void startDocument() throws SAXException {
              System.out.println("Parsing begins...");
         public void endDocument() throws SAXException {
              System.out.println("...Parsing ends.");
         public void processingInstruction(String target, String data)throws SAXException {
              System.out.println("PI: Target:" + target + " and Data:" + data);
         public void startPrefixMapping(String prefix, String uri) {
              System.out.println("Mapping starts for prefix " + prefix + " mapped to URI " + uri);
         public void endPrefixMapping(String prefix) {
              System.out.println("Mapping ends for prefix " + prefix);
         public void startElement(String namespaceURI, String localName,String rawName, Attributes atts)throws SAXException {
              System.out.print("startElement: " + localName);
              if (!namespaceURI.equals("")) {
                   System.out.println(" in namespace " + namespaceURI + " (" + rawName + ")");
              else {
                   System.out.println(" has no associated namespace");
              for (int i=0; i<atts.getLength(); i++)
                   System.out.println(" Attribute: " + atts.getLocalName(i) +"=" + atts.getValue(i));
         public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
              System.out.println("endElement: " + localName + "\n");
         public void characters(char[] ch, int start, int end) throws SAXException {
              String s = new String(ch, start, end);
              System.out.println("characters: " + s);
         public void ignorableWhitespace(char[] ch, int start, int end)throws SAXException {
              String s = new String(ch, start, end);
              System.out.println("ignorableWhitespace: [" + s + "]");
         public void skippedEntity(String name) throws SAXException {
              System.out.println("Skipping entity " + name);
    } //close class

  • How do I transport specific Cost Element Groups ?

    I've used OKE6 to transport ALL CE groups, now I want to know how to transport specific ones ?

    You can use transport of a Set instead.
    You can find this in a customizing under Financial Accounting (New) -> Special Purpose Ledger -> Tools -> Transport -> Transport Sets and Variables
    The thing is, that I would like to know, if there is also a possibility to delete defined CE groups in all systems/clients via transport?
    Does anyone know about this?
    Thanks,
    Petr

  • How can I force specific devices to use a specific Airport Express?

    I have an Airport Extreme router on the main level of my three level house. I have a 1st Generation Airport Express on the same level, extending my wireless network and acting as an airplay device.
    I have added another Airport Express (2nd Generation) in my basement to be close to several wifi-ready devices (Wii, AV receiver, Blu-ray player). How can I force these particular devices to connect to the new and 'closest' device, just 20 feet away? Some, but not all, are connecting still to my Airport Extreme with a 'good/average' connection. Specifically, I'd like to force the blu-ray player to use my new Express, to eliminate buffering on my blu-ray player (Vudu - movie rentals).
    Suggestions?

    It might help to remember that the AirPort Express...or any other "extending" device....can only extend the quality of signal that it receives.
    So the trick is to get the best signal possible to the extending device......and also....have it provide a good signal for other devices.  It's a compromise at best with the best location for the "extending" device about half the distance between the main router and the devices that need more wireless signal.
    This assumes no major obstructions in the signal path.....and unfortunately a floor/ceiling is a major obstruction....often the thickest barrier in a home.
    Unfortunately, users tend to locate the extending device where they feel that they need more wireless coverage....in a weak signal area....and then the extending device receives a weak signal and extends that weak signal quality.  The result is little or no improvement at all.
    It is going to take some experimentation to find the best compromise if you want to extend using wireless only. Even a good connection results in half of the bandwidth being lost, so you might want to think about a "Plan B" in case wireless will not deliver the bandwidth that you need.

  • How to unmarshall list tags/unbounded elements using jax-ws auto generated classes in weblogic 12c

    hi
    i have a need wherein i need to create/host jax-ws webservice ( starting from wsdl) and in that service translate the xml using xsl to a different structure and call another webservice hosted to another server ( non-weblogic).
    so my approach is as soon as request comes to the service impl, i marshal the object to a xml then apply the required xsl transformation and then unmarshal the transformed xml to the object which can be used to trigger another webservice.
    This approach works fine for the xmls without list tags/unbounded elements , however it gives marshal exception whenever the xmls has list/unbounded elements.
    i am using jaxb and jax-ws generated class for marshalling and unmarshalling.
    so need some help on how to deal in this scenario?
    any help is appreciated

    hi
    i have a need wherein i need to create/host jax-ws webservice ( starting from wsdl) and in that service translate the xml using xsl to a different structure and call another webservice hosted to another server ( non-weblogic).
    so my approach is as soon as request comes to the service impl, i marshal the object to a xml then apply the required xsl transformation and then unmarshal the transformed xml to the object which can be used to trigger another webservice.
    This approach works fine for the xmls without list tags/unbounded elements , however it gives marshal exception whenever the xmls has list/unbounded elements.
    i am using jaxb and jax-ws generated class for marshalling and unmarshalling.
    so need some help on how to deal in this scenario?
    any help is appreciated

  • How to call a specific page without using a link

    Hi there ,
    I am using Jdeveloper Studio Edition Version 11.1.1.1.0 , ADF BC.
    Here is the question: I’d like to find a way to call a page using a text input as an alternative way to use the menu hierarchy.
    That is, On the main page I have a text Input; assuming that each page is assigned to a specific code the following would be the scenario:
    The user enters the code in the text Input and after form submission, the prospective page would be appeared.
    Best Regards,
    Yasaman Parandian
    P.S: Regarding security issues; I am so looking for a solution in which JHS_ tables are used.

    Yasaman,
    Your question is not related to JHeadstart but requires general ADF Faces and ADF Taskflow skills.
    Please use the JDeveloper forum for your question. Once, you got it to work by manually changing a generated page, this forum can help you with using custom templates to keep your page generatable.
    Steven Davelaar,
    JHeadstart team.

  • How to change value of array element using property node

    hello all : )
    im using an array of combo-box. the size of array is not fixed.
    i want to use the strings[ ] property of combo-box to enter selection texts but since i have placed it inside the array im unable to use this property.
    i used 'arrayelem' reference property and connected property node to it but didnt got strings [ ] in the selection.
    so is there any way i can use the strings [ ] property
    Solved!
    Go to Solution.

    the picture what I posted is a snippet. It is a png file which also contains a vi:
    http://www.ni.com/tutorial/9330/en/
    I have found this post. I am just reading it:
    http://forums.ni.com/t5/LabVIEW/combobox-in-array-why-does-it-work-this-way/m-p/2146916/highlight/tr...
    It might help...
    hmm, it is more complicated as I thought )
    edit: just to be CLEAR: so you want to create a new selection LIST for each of the array elements (comboboxes)) OR you just want to set all the comboboxes to a particular value which is ALREADY in the combobox list??

  • How to parse this specific text

    i am stucked in this crictical problem and i don't know how to cater this. I sometimes receive this String ����&#9658;&#9787;&#9786; and sometimes these are non US-ASCII characters. These ����&#9658;&#9787;&#9786; characters are replaced by ????? and is represented as it is. I sometime receive this character �� too. These characters are in ANSI list but i want to receive only US-ASCII. Please help me out that how to identify these characters in the string.

    They are undoubtedly hex. Download a hex editor and view the values to see if they make sense. If you simply want to strip out the alphanumeric characters, write a simple RegEx expression.
    - Saish

  • How to parse a web page and use same session(?) to post ?

    hi,
    lets say there a web page requesting:
    -username
    -password
    -sequence of letters ( assume its not an image, it is just plain text)
    i can get the source of page and parse and find the sequence.
    however i couldnt manage to post it. (the sequence changes)
    any help would be great, thx..
            try {
                int statusCode;
                String urlAddress =  "mywebpage";
                HttpClient client = new org.apache.commons.httpclient.HttpClient();
                String key ="";
                URL url = new URL(urlAddress);
                URLConnection conn = url.openConnection();
                DataInputStream in = new DataInputStream ( conn.getInputStream (  )  ) ;
                BufferedReader d = new BufferedReader(new InputStreamReader(in));
                StringBuffer buffer = new StringBuffer();
                while(d.ready())
                   buffer.append(d.readLine());
                int index = -1;
                String contents =buffer.toString();
                index = contents.indexOf("operation");
                while (index  > -1) {
                    key  = key + contents.substring(index+10,index+11);
                    index = contents.indexOf("operator", index+11);
                System.out.println(contents);
                System.out.println(key);
                /*GetMethod getMethod = new GetMethod(urlAddress);
                getMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
                statusCode = client.executeMethod(getMethod);
                if (statusCode != -1) {
                    contents = getMethod.getResponseBodyAsString();
                    index = -1;
                    index = contents.indexOf("mp3sesler");
                    while (index  > -1) {
                        key  = key + contents.substring(index+10,index+11);
                        index = contents.indexOf("operation", index+11);
                    System.out.println(contents);
                    System.out.println(key);
                PostMethod method = new PostMethod(urlAddress);
                // Configure the form parameters
                method.addParameter("user", "test");
                method.addParameter("pwd", key);
                // Execute the POST method
                statusCode = client.executeMethod(method);
                if (statusCode != -1) {
                    contents = method.getResponseBodyAsString();
                    method.releaseConnection();
                    System.out.println(contents);
            } catch (Exception e) {
                e.printStackTrace();
            }

    perhaps the website checks its source? What HTTP response do you get back?

Maybe you are looking for

  • FS10N  g/l Balance not show

    Dear Guru ,   Issue is , When i Check GR/IR Clearing  /ac in FS10N , the for period 1, 2 and 3 Period toal dr and cr Balance does not display. balancy disply only for 4 and 5 Balance . I already check in GLT0 Table , thr also sys does not show  G/L B

  • Airport Express switch to N-Only , Unable to Connect or Even detect router.

    Hi, I have a macbook pro from early feb 2008 with the penryn processor in it and an airport express wireless N. When i have the airport express in 802.11n (b/g compatible) i'm able to connect and see the router wirelessly, but when i do N only (2.4 o

  • Acrobat 9 Pro Broken In Vista

    I have Acrobat 9 Pro installed on Vista 32-bit, but it can't even do simple PDF printing from something like Word or IE without getting "Access Denied." I have UAC-enabled and do NOT plan to disable it anytime soon. The Adobe PDF printer is installed

  • Problem in running entity bean examples

    I am trying to run a entity bean example in my bea ,earlier i was getting the error that the data source name could not be found ,and so i replaced the data source name in my .xml file as cgDataSource and now i am not finding that error ,and the jsp

  • EDI trading partner setup

    I have my organization is set as Party under parties. say MyOrg I created another party say Party1 then create agreement between  Party1 and MyOrg . Good working fine. Now I have Party2 and trying to create agreement  between Party2 and MyOrg . In bo