#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0

    Question servlet output- urgent!!


    Hi,

    I am sending a username and password to a servlet for authentification. The servlet authentifies and outputs the response as:
    <?xml version="1.0" ?>
    - <palm_resp>
    - <palm_prof>
    <sess_id>123</sess_id>
    - <user>
    <code>123</code>
    <name>manuel</name>
    </user>
    - <app_info>
    <app_id>APP_1</app_id>
    <app_name>aplicacao 1</app_name>
    </app_info>
    </palm_prof>
    </palm_resp>


    I need to obtain this response in my PHP code in a variable so that I can parse it later.. Can anyone pl tell me as to how I can send this info from my servlet to my PHP??

    TIA,

    sandeep
  2. #2
  3. No Profile Picture
    Java Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    5
    Rep Power
    0
    I've probably read this wrong, but it sound like one of the following

    1) http response such as

    PrintWriter out = res.getWriter();
    out.println("<authourised>true</authourised>");
    out.flush();
    out.close();

    2) you want the servlet to send and HTTP request to the PHP (which sound like a weird way of doing something, as it completely negate the transactional approach of servlets), but I don't know your reasoning, so you probably want to do it as below...

    HttpURLConnection con = (HttpURLConnection)new URL("http://www.phpserveraddress/phpscript.php?authourise=true");
    con.setRequestMethod("GET");
    con.getResponseCode();

    Is that any help?

    Oscagne
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    26
    Rep Power
    0

    diff problem


    I do get the data now but hv a diff problem of that of parsing the data..

    Hv posted the query on the PHP forum..

    thnx,
    gaucho

IMN logo majestic logo threadwatch logo seochat tools logo