How to reuse a response from a server in the next request?

Hello all,
I am invoking the doGet method to get authenticated by the clickatell's server... the server responds with a "Ok: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" (not exact values) message in a fresh html page. This is the status code and its session_id after authentication.
The problem is, how to reuse the session_id value in a request to invoke the doPost method?
Can anyone help with an idea?
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
     String urlStr = new String ("http://api.clickatell.com/http/auth?api_id="
     + api_id + "&user="
     + username + "&password=" + password);
     res.sendRedirect(res.encodeRedirectURL(urlStr)) ;     
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {          
     String msg, to;
     msg = req.getParameter("msg");
     to = req.getParameter("to");          
     String urlStr = new String ("http://api.clickatell.com/http/sendmsg?session_id=" +sessionID + "&to=" + to + "&text=" + msg);
HttpServletResponseWrapper hsrw = new HttpServletResponseWrapper(res);               
     res.sendRedirect(res.encodeRedirectURL(urlStr));
}

Hello,
Can you try with the following code after doing appropriate modifications for your requirements.
package servlet;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.net.*;
public class TestServlet extends HttpServlet {
     public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
          System.out.println("Start ..........................................................");
          URL url                              = new URL("Your Portlet URL");
          HttpURLConnection urlConn     = (HttpURLConnection)url.openConnection();
          String toPost = "Your string";
          System.out.println("URLConnection object\t" + urlConn);
          urlConn.setDoInput(true);
          urlConn.setDoOutput(true);
          urlConn.setUseCaches(false);
          urlConn.setRequestProperty ("Content-Type", "Appropriate content type");
          //urlConn.setRequestProperty("Content-Length","Appropriate content length");
          urlConn.setRequestMethod("POST");
          OutputStream out = urlConn.getOutputStream();
          out.writeBytes(toPost.getBytes());          
          out.flush();
          out.close();          
          PrintWriter outStream = new PrintWriter(res.getOutputStream(),true);
          DataInputStream in = new DataInputStream(urlConn.getInputStream());
          String inputLine = in.readLine();
          while(inputLine!=null){
               outStream.println(inputLine);
               inputLine= in.readLine();
          outStream.close();
          in.close();
          System.out.println("End ...........................................................");
As long as you do not get input stream from your URL Connection you will experience problems. Also the parameters should be passed as query string in the url. Rather pass them using output stream object obtained from URL connection. Also in your responding servlet you will be required to read the parameters using an Input Stream something like this.
DataInputStream in = new DataInputStream(request.getInputStream());
               String inputLine = in.readLine();          
               while(inputLine!=null){
                    System.out.println("Input Received by servlet\t" + inputLine);                                        
                    inputLine = in.readLine();
HTH
VJ

Similar Messages

  • How to send SAML response from ADFS server on web page

    Hi
    I have integarted ADFS and Orcale application for single sign on.
    problem description: need SAML token on web page which published on application.
    please tell me; how to set SAML response on web page defined on ADFS or what configuration required from ADFS side to send SAML response.
    Regards
    Kapil

    This has a web app that will display claims. You could probably modify it for your needs. 
    http://blogs.technet.com/b/askpfeplat/archive/2013/12/23/how-to-build-your-adfs-lab-on-server-2012-part2-web-sso.aspx
    Mark Morowczynski
    Microsoft Senior Platforms PFE
    Blog:
    http://blogs.technet.com/b/askpfeplat  Twitter:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • How can uncompleted events carryover from one day to the next?

    Let's say I had to call Mr. Smith on Monday, but never got to call him. How can I have this uncompleted reminder carry over to Tuesday automatically?? And every day from there on until I do call him and delete the event. Is this possible??
    Any help will be most welcomed.
    Jorge L. Belendez
    MAC MINI   Mac OS X (10.4.4)  

    It will automatically remain in your task list & show a exclamation point since it isn't done. However, if you have the hide to dos with due dates outside the calendar view enabled in preferences, you won't see the older tasks if they aren't in the calendar view.
    I've posted an enhancement request to Apple & suggest you do the same so that older tasks still show outside the calendar view with that option enabled.

  • How to make swatches persistent from one document to the next?

    I want to have a custom swatches in my  workspace each time I open a document. How can I make swatches persistent in InDesign?

    You can have swatches available in new documents if you make them part of your defaults by loading them while no document is open, but there is no way that I know of to open any existing document that doesn't have a particular swatch and have that particular swatch available without loading it yourself. Probably the quickest way to load them into existing documents would be to:
    Make a frame
    Fill it with a swatch
    Repeat steps 1 & 2 until you have a frame for each swatch you want to transfer
    Grab all of the frames and drag them together into a library as one entry
    When you open a file, drag the frames from the library to the doc and immediately delete them while they are still selected. All of the swatches will have been added to your swatches list, and it's a little quicker than going to the swatches fly-out, selecting Load Swatches and navigating to a file that has the swatches saved in it, but that's another way if you prefer.

  • How do I trancfer music from one computer to the next?

    I need help puting music from my iPod to iTunes.

    Hey DougLong
    If you have purchased content on the iPod, you can transfer those items by following the steps in the following article.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/ht1848
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • How do I transfer data from one pg to the next pg?

    I have a registration page that I would like to go to a
    welcome page when registration is complete. The welcome page will
    say "Welcome (name) your new username and password are (user &
    pwd)". I have tried unsuccessfully using cookies to populate the
    welcome page. Since the user will only see this welcome page one
    time, is there some other way to do this? Can I get the needed
    fields from my database? BTW - the registration page works just
    fine.

    What scripting language are you using? Why not use session
    variables?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Mr. Brownie" <[email protected]> wrote in
    message
    news:egukl8$9a8$[email protected]..
    >I have a registration page that I would like to go to a
    welcome page when
    > registration is complete. The welcome page will say
    "Welcome (name) your
    > new
    > username and password are (user & pwd)". I have
    tried unsuccessfully
    > using
    > cookies to populate the welcome page. Since the user
    will only see this
    > welcome page one time, is there some other way to do
    this? Can I get the
    > needed fields from my database? BTW - the registration
    page works just
    > fine.
    >

  • How to move apps from one screen to the next?

    In order to organize a bit the screens after installing several apps, how can we move them from one screen to the next?
    I've found it possible to place them in the lower bar and then replace them into the required screen but that's very slow...
    Any other way?
    Also, is it possible to place the apps where we want and not get them automatically reorganized (blanks filled)?
    Thanks,

    Sorry I guess the correct terminology would be 'virtual desktops'.
    You pass from one virtual desktop to another swiping left or right on the phone.
    I would like to switch conveniently an app (icon) from one virtual desktop to another.

  • How to decrease timeout value when there is no response from BOE server?

    We are using BOE XI R2 .NET SDK to logon BOE XI R2 Server as below as well as using Infoview/CMC logon BOE:
    set boSessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr")
    set boEnterpriseSession = boSessionManager.Logon(boUserID, boPassword, boCMS, boAuthType)
    There is no response for long time from BOE server after I excuting log on BOE using .NET SDK or Infoview/CMC App for more than one minute.
    So I want to timeout the logon atction after a certain time such as one minute if there is no response from BOE server.
    My question comes:
    1. What is the default timeout value for this operation?
        Where can I find it and how to modify it?
    2. I found ther are some registry keys on .NET APP Server:
        HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\InprocServer\EnterpriseRequestTimeout
        HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Client SDK\CorbaAdapter\WaitReplyTimeout
    Are they for the action timeout I mentioned above? If not, what do they work for?
    It seems that WaitReplyTimeout is for report data retrieval timeout according to Kbase article 1199286 and which registry setting to change for long running reports, is it correct?
    Thanks for any response.
    Thanks,
    Sunny

    I don't think there is a setting available for this.  The timeouts you are looking at are essentially how long to wait for a report to process.
    My concern about trying to find a setting like this is that if you do get the client (aka SDK) to timeout after one minute, the CMS may still recieve this request shortly after and logon, creating a session that no longer has a handle to it and will then have to wait for it to timeout because of inactivity which would tie up a license.

  • No Response From Application Server - How To over come this error message

    I am Using Oracle 10g Application server. if we run a report from our front end - jsp , if the transaction takes more than 10 minutes then 'No Response From Application Server ' error message is coming in browser. How to over come this. whether i have to set any transaction time in application server. If anybody knows this kindly give reply immediatly.

    There are settings in the reports configuration to modify your timeout. This is documented in the repors config file itself.
    cu
    Andreas

  • No Response From Application Server-how to overcome this error message

    I am Using Oracle 10g Application server. if we run a report from our front end - jsp , if the transaction takes more than 10 minutes then 'No Response From Application Server ' error message is coming in browser. How to over come this. whether i have to set any transaction time in application server. If anybody knows this kindly give reply immediatly.

    Can you provide additional background information? Is this a in-house application serviced through an OC4J container or a Report from the Middle Tier install?
    Is this request being front-ended by an OHS server? Are there firewalls involved?
    Regards.

  • No Response From Application Server - Oracle 10g

    I am Using Oracle 10g Application server.
    When running a transaction (query to the DB) sometimes it takes more than the "x" session.timeout minutes seted.
    Then 'No Response From Application Server ' error message comes out.
    I don`t want to increase the session.timeout minutes because i do want it to work in other issues. The thing is that i don`t want the session to be terminated when waiting for the response from the DB.
    How can i overcome this?
    Thanks

    Thanks for answering...
    Sorry, i`m new in this. I`m using j2EE technology.
    The thing is that i was trying to do a page that prints a loading... while waiting for the response from the DB, but when it comes the resultset, and i redirect to another servlet to print the results, an illegalStateException came out (the response has already made the commit).
    So i was thinking maybe there was a solution for the application to know that the query is being made in the DB(and that the app/session isn`t stopped).
    Maybe with another driver? now i`m trying the ojdbc14.jar.
    Or maybe in J2EE I can do a page that self reloads every "x" minutes while waiting for the response from the DB as you said and when it comes prints it ?
    Thanks a lot
    Andres

  • Error: Unable to process the following response from FOI server

    Hi
    While integrating BI with mapviewer, I am getting the following error:
    Unable to process the following response from FOI server
    Please let me know how this can be fixed
    Thanks & Rgds
    Dipesh
    Message was edited by:
    user542575

    One more question about NSDP, Im still wondering how can NSDP work as you only need to declare nsdpInfo.setKeyColumn("xx") --xx
    Eg. My result set come from OBIEE, it hase 2 column xx and yy.
    Im just copy the sample code to translate the output into xml, the output sample is like:
    Column 1 Column 2
    440100 0
    440200 5
    440300 1
    So how can MapViewer know that the second column is the value column?
    The same question is about when the output is multiple column.

  • Hi,how can i transport objects from one server to other like (Dev To Qty)

    Hi Sir/madam,
       Can u explain how can i transport objects from one server to other like (Development To Quality To Production).
    Regards,
    Vishali.

    Hi Vishali,
    Step 1: Collect all Transports(with Packages) in Transports Tab(RSA1)- CTO
    Step 2: Release the subrequests first and then the main request by pressing Truck button
    Step 3: STMS or Customized transactions
    Object Collection In Transports:
    The respective Transports should have the following objects:
    1. Base Objects -
    a. Info Area
    b. Info object catalogs
    c. Info Objects
    2. Info Providers u2013
    a. Info Cubes
    b. Multi Providers
    c. Info Sets
    d. Data Store Objects
    e. Info Cube Aggregates
    3. Transfer Rules u2013
    a. Application Components
    b. Communication Structure
    c. Data Source replica
    d. Info Packages
    e. Transfer Rules
    f. Transformations
    g. Info Source Transaction data
    h. Transfer Structure
    i. Data sources (Active version)
    j. Routines & BW Formulas used in the Transfer routines
    k. Extract Structures
    l. (Note) If the transfer structures and related objects are being transferred without preceding
    Base Objects transport (e.g. while fixing an error) it is safer to transport the related Info
    Objects as well.
    4. Update Rules u2013
    a. Update rules
    b. Routines and formulas used in Update rules
    c. DTPs
    5. Process Chains u2013
    a. Process Chains
    b. Process Chain Starter
    c. Process Variants
    d. Event u2013 Administration Chains
    6. Report Objects u2013
    a. Reports
    b. Report Objects
    c. Web Templates
    Regards,
    Suman

  • How to upload XML file from Application server.

    Hi,
    How to upload XML file from Application server.Please tell me as early as possible.
    Regards,
    Sagar.

    Hi,
    parameters : p_file type ibipparms-path obligatory.
    ***DOWNLOAD---->SAP INTO EXCEL
    filename1 = p_file.
    call function 'GUI_DOWNLOAD'
      exporting
      BIN_FILESIZE                    =
        filename                        = filename1
        filetype                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = it_stock
      FIELDNAMES                      =
    exceptions
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       others                          = 22
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Deepthi.

  • How can i copy ztable from development server to ides server?

    how can i copy ztable from development server to ides server?

    Hello Suresh
    The simplest way is to use a transport request.
    Another possibility is to check for SAPLINK plugins which allow to download table definitions (including data elements and domains) into a flat file. Upload on IDES again via [SAPLINK|https://wiki.sdn.sap.com/wiki/display/ABAP/SAPlink].
    Regards
      Uwe

Maybe you are looking for

  • Old iPod mini with a new iMac using a different iTunes library

    I just bought a new iMac (never before owned one). I have an iPod mini with a bunch of music on it that I downloaded from a library on an IBM, which I no longer have. How can I transfer all of the music that is currently on my iPod mini to the librar

  • Hi, every sap guru's

    would u please tell me some answers to my questions 1)  what is the purpose of new gl account in ECC 6.0   2) what is the purpose of document splitting?   3) can u generate balancesheet report in fi using report painter? if it generate plz give me so

  • Error in using XI-SOAP adapter, but no error  with SAP-BC

    Hi, I am working on RFC->XI->Webmethod (.asp) scenatio. I am using SOAP adapter. Whin I am not using "Do not use SOAP Envelop". I am getting "com.sap.aii.af.ra.ms.api.DeliveryException: invalid content type for SOAP: TEXT/HTML" Error in SXMB_MONI. Bu

  • Is anyone else having problems with Office for Mac and Lion?

    Since installing Lion 10.7.1 on a macbook pro 2.53 Ghz 4GB 1067 MHz DDR3 I have had no end of problems. Both Excel and Word hang, crash and saving an Excel file is a pain. A 12mb spread sheet just took 4 minutes to save! I have MS Office for Mac 2011

  • Create a DNG file that does not show changes when viewed by others

    I am adjusting my RAW Images in Adobe Lightroom and want to export them as DNG without betraying the evidence of my post production efforts- is there a way to save an altered file as a DNG without showing the client which changes I have made when the