How to read the response from the request made from teh client using java

Hi All,
I am using the following code to connect to the sever .
HttpRequest httpRequest     = new HttpRequest();
httpRequest.setMethod(method);
if( null == uri )
uri = "";
httpRequest.setURI(myReplaceAll(uri, ' ',"%20"));
httpRequest.setHeader(CONTENTTYPE, CONTENTTYPE_XML);
httpRequest.setHeader(TRANSLATE, "f");
httpRequest.setBody((String) null);
IResponse httpResponse = null;
try
httpResponse = getRequester().perform(httpRequest);
int httpStatus= response.getStatus();//get the response code
I want to read the response stream that will be returned from this connection.
Can you please help me in this case.
Thanks and Regards,
Anamika Mazumder.

IResponse provides getDocument() (for XML) and getStream() (otherwise). Only one of them will work; I don't recall how it chooses. See http://help.sap.com/javadocs/NW04s/current/km/com/sapportals/wcm/util/http/HttpRequest.html#expectsResponseDocument(boolean).
And, btw, do not construct URIs by text replacement; there are proper URI parsing/generator classes for this purpose in KM.

Similar Messages

  • When I activate my Firefox e-mail account using Yahoo, the response is "bad request" and I can't open my mail.

    I use Yahoo as my search engine...I use an e-mail account. When I activate the icon for mail..the response says "bad request". What is happening

    This issue can be caused by corrupted cookies.
    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"

  • Im switching email accounts on my itunes account am the computer isnt recognizing purchases made from my other account on the new one (apps). How can I sign in with my new account and get the purchases apps on both accounts?

    Im switching email accounts on my itunes account am the computer isnt recognizing purchases made from my other account on the new one (apps). How can I sign in with my new account and get the purchases apps on both accounts?

    This was EXACTLY what I needed about the purchases I made from my device. However, is there a way to re-download other ones you've made from a computer? Because I realized some of them were not just purchased from my device.
    This is a picture of what it looks like now:
    http://tinypic.com/r/107quxu/7
    As you can see, the stuff circled in red doesn't give me an option to download from Cloud Beta because it already says "downloaded".
    any way to get around that?

  • Send command to modem using serial port and capture the response in the labview

    hello.
    I am doing my shool project.
    I want to send command to modem using serial port and get the response in the labview.
    When i run my program and enter"AT", only messy code will be displayed.
    can anyone help me? thanks 

    Dora0512 wrote:
    Thanks for you all. My partner got it already.
    I am doing send sms part.
    Can anyone tell me why my program is not so steadily?
    It means this program can run. But somtimes I cannot receive sms. sometimes can
    Basically, it is not well-written from both a LabVIEW and a communications point of view.  Unfortunately, I can't elaborate because today is an exrtremely busy day at work.  I'm hoping this bump will prompt someone to help you with your problem.  If you could also provide us with the programmer's guide or the manual for your equipment, that would be extremely helpful.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to read a variable within a VC code.  I am using BADI based VC code.

    How to read a variable within a VC code.  I am using BADI based VC code.
    Lets say I have a variable for a fiscal period that holds cumulative month.
    If user enters 03/2014 in that variable, it will have month starting from Jan till March.
    Within VC code I would like to read the last month which is
    03/2014 and based on this month I would like to do some calculation on all the records using the last month.
    Since VC code runs for one record at a time and there is no way I can store this value.
    Is there a way to go about it....any suggestions would be of great help.
    Thanks.

    Any suggestions would be highly appreciated.
    Thanks!

  • Can we know the geographical info(country, region, city,...etc) using java

    Hello Everyone,
    I'd like to know the geographical info(country, region, city,...etc) of client using java API.Is this possible?
    I have searched on the web.However, I could not get any info.
    Could someone let me know whether it is possible or not,Please?
    Any help would be appreciated.
    Thanks.

    Albert_EINstEIN wrote:
    Thank you friends for your replying.We know that default language is English.In some cases client may belong to another country other than US.In this case we get the country US if we use below code.
    java.util.Locale.getDefault().getCountry();
    I am afraid this is not always correct.It obtains the info from the underlying operating system. There's no other way around this, other than asking your users themselves. Why do you need this?

  • How to generate possiable no of words by taking A-Z letters using java

    How to generate possiable no of words by taking A-Z letters using java.please give the code don't take repeation of letters
    ex: lets take a,b,c & the possiable no of words are list below
    a
    b
    c
    ab
    ac
    ba
    bc
    ca
    cb

    srikanth wrote:
    How to generate possiable no of words by taking A-Z letters using java.please give the code don't take repeation of letters
    ex: lets take a,b,c & the possiable no of words are list below
    a
    b
    c
    ab
    ac
    ba
    bc
    ca
    cbSorry, but have you even attempted to do this yourself yet?

  • How can I launch a site that I designed for a client using their MobileMe account? Can they 'open' my iWeb files on their iWeb software?

    How can I launch a site that I designed for a client using their MobileMe account? Can they 'open' my iWeb files on their iWeb software?

    If you give them the Domain.sites2 file that iWeb used to create the site  they will be able to open it with iWeb application (it has to be the same version as you have) and make changes.  But if you're expected to also make changes you'll need a way to send that file back and forth between the two. 
    Also there's an online MacWorld article that describes a way that both of you could manage the site using Dropbox.  Look at Managing an iWeb site from multiple Macs.
    OT

  • How to check whether a Document in KM is classified or not using JAVA API

    Hello Everyone,
      Can anyone tell me, How to check whether a Document in KM is classified or not, using JAVA API's??
    Thanks & Regards,
    Adren D'Souza

    Hi,
    The code is as follows:
    IIndexService indexService = null;
    try {
       indexService = (IIndexService) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.INDEX_SERVICE);
    } catch (ResourceException e) {
       if (indexService == null) {
         log.errorT("Error on instanciating the index service");
         return this.renderMessage(this.getBundleString(RES_NO_INDEX_SERVICE), StatusType.ERROR);
    // get index
    IIndex index = null;
    try {
       index = indexService.getIndex("YourIndexID");
    } catch (WcmException e1) {
       log.errorT("Error when trying to get the index");
       return this.renderMessage(this.getBundleString(RES_NO_INDEX), StatusType.ERROR);
    // check if the index is a instance of AbstractClassificationIndex
    AbstractClassificationIndex classiIndex = null;
    if (index instanceof AbstractClassificationIndex) {
       classiIndex = (AbstractClassificationIndex) index;
    } else {
       log.errorT("The index " + index.getIndexName() + " is no classification index");
       return this.renderMessage(this.getBundleString(RES_NO_CLASSIFICATION_INDEX), StatusType.WARNING);
    //give your KM Resource here for which you want to know if it is classified or not
    boolean classified = classiIndex.isDocClassifiedInAnyTax(resource);
    Regards,
    Praveen Gudapati

  • How to get the response of a vbscript ran from extended js?

    Hi All,
    I  want to get the result from a vbscript, how to get that in my jsx? This is what I'm doing-
    vbscript (this will return me something, i've added just a sample string)
    Wscript.Echo "Like this?"
    jsx
    var a = File("C:\\Users\\Sahil\\AppData\\Roaming\\CreativeWorx\\1.vbs");
    var b=a.execute();
    Now, variable b returns me true/false; and the output i.e. "Like this?"  is alerted! So my question is-
    1. How to get the output in a variable?
    2. How to avoid the alert
    So, I simply wish to get the output from my vbscript and then perform certain functions accordingly, alos, I dont want  this to be alerted!
    Any help will be highly appreciated!

    The capitalization is app.doScript and not app.doscript that is if you are trying to get a jsx script to run and access a string from from a vbs script.
    When defining the VBscript for multiline scripts the easiest method is to use triple quotes
    VBscript = """dim WMI:  set WMI = GetObject("winmgmts:\\.\root\cimv2")
    dim Nads: set Nads = WMI.ExecQuery("Select * from Win32_NetworkAdapter where physicaladapter=true")
    dim nad
    for each Nad in Nads
        if not isnull(Nad.MACAddress) then Wscript.Echo Nad.description, Nad.MACAddress  
    next"""
    when using the scriptArgs you can either make a loop of them and send the string value of each one something like this
    For (n = 0 .........
    myArg = "myArg" & n
    myStringToPassOver = "Shaddow Fax " & n
    app.scriptArgs.SetValue myArg, myStringToPassOver
    Next
    or probably better to make a long comma or something else separated string and pass it over after the loop
    var VBScript = """myArg = ""
    For n = 0 To 15
    myArg = myArg & "Shaddow Fax " & n & ","
    Next
    app.scriptArgs.SetValue "myResult", myArg
    app.doScript(VBScript, ScriptLanguage.visualBasic);
    var myResult = app.scriptArgs.getValue("myResult").replace(/\,$/,"").split(",");
    // if neaded use "replace" to remove final "," and "split" to convert into an array
    alert(myResult.join("\r")); // alert the array
    The above script is a jsx script that runs a vbs
    If you want a vbs script to run and access a string from from a jsx script then you would use xxx.DoScript see the sample from the manual below.
    Set myInDesign = CreateObject("InDesign.Application")
    myJavaScript = "alert(""First argument: "" + arguments[0] + ""\rSecond argument: "" +
    arguments[1]);"
    myInDesign.DoScript myJavaScript, idScriptLanguage.idJavascript, Array("Hello from
    DoScript", "Your message here.")
    myVBScript = "msgbox arguments(1), vbOKOnly, ""First argument: "" & arguments(0)"
    myInDesign.DoScript myVBScript, idScriptLanguage.idVisualBasic, Array("Hello from
    DoScript", "Your message here.")
    P.s.Please mark the question as answered, thanks

  • How to read XML response from a URL in java?

    Hi .
    I need to write a simple function that takes a URL and processes the response which is XML or JSON.
    I tried this code:
    URL l_url = new URL(serviceURL);
    URLConnection urlConnection = l_url.openConnection();
    InputStream inputStream = l_url.openStream();
    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    Document inputXML = documentBuilder.parse(inputStream);
    but in line number 3 it throws an error:
    "l_url.openStream() = >Exception occurred in target VM: Server returned HTTP response code: 401 for URL:"
    Please let me know how do I achieve it.
    Thanks and regards,
    Sonal

    Sonal wrote:
    "l_url.openStream() = >Exception occurred in target VM: Server returned HTTP response code: 401 for URL:"
    Please let me know how do I achieve it.you achieve it by fixing your authentication problem (401 is the response code indicating your request was not authorized, which you can easily find out with a simple google search).

  • How to read a file inside the JAR file

    Hi All,
    I want to save some preferences in a file called "preferences". I kept the preferences file under my java package.
    If i am running the code inside the NetBeans 6.9 IDE it's working file. But once i have created a JAR and try to run the application, it couldn't find the path.
    Please help me that how to resolve this issue. I don't want to save this preferences file outside of my JAR (i.e) within my java package.
    Here is the code,
    package mypackage;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    public class ReadFile
        private void writeFile()
            try
                OutputStream out = new FileOutputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
                PrintWriter writer = new PrintWriter(out);
                writer.println("Hello Java!");
                writer.close();
                out.close();
            catch (Exception ex)
                System.out.println(ex.getMessage());
        private void readFile()
            try
                FileInputStream fi = new FileInputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
                BufferedReader br = new BufferedReader(new InputStreamReader(fi));
                System.out.println(br.readLine().trim());
                br.close();
                fi.close();
            catch (Exception ex)
                System.out.println(ex.getMessage());
        public static void main(String[] args)
            ReadFile read = new ReadFile();
            read.writeFile();
            read.readFile();
    }If i run the JAR, i get the following error message,
    {color:#ff0000}*file:\my jar path\jarname.jar!\mypackage\preferences (The filename, directoryname, or volume label syntax is incorrect)*{color}

    Thanks sabre150,
    sabre150 wrote:
    You cannot update a running jar file. I am sorry. I didn't know about it. Thanks to point out.
    There are two ways I approach this depending on my exact requirements -
    1) use the java.util.prefs.Preferences APII will try this one
    >
    2) if not already present I copy the preferences file from the jar to a known place. I use a directory in the user's home directory and normally make the directory name the program with a '.' prefix.
    One cannot access files in a jar file using the File API. One needs to use the getResource() or getResourceAsStream() methods on Class or ClassLoader.

  • How to read  input data of the process which running fine

    Hi Guys,
    How to read the recently completed BPEL PROCESSes input data ( input xml) .
    Please help me.
    Regards
    janardhan

    Some browsers behave differently, FireFox 2 generally works better than FireFox 3 and IE.
    If you select the process that has run from the BPEL console in the instances tab you can select Audit or Flow. Audit generally works best at seeing the XML being past to each activity but the flow is nice to follow graphically. The major issue with the flow is that some payloads are displayed as a URL link. In IE this sometimes doesn't work. If this is the case go to the same point in the Audit and the XML will be there. This is also a good place to copy and paste xml for documentation purposes.
    cheers
    James

  • How do I create a header in the response table for a column I want to use that is not on the form it

    Example: My form has 10 fillable questions.  The Response table uses 10 columns to show the answers to those questions.  I would like to use 3 more columns to record internal information.  How do I insert the header titles?

    Hi,
    You can go to Responses view tab, focus on your last column header and then click menu Table->Add Column After. Or you click + button at the end of table - refer below image.
    I am not clear your question "How do I insert the header titles?" Do you mean you want to use your form title as data value in each cell in the column? If yes, you can set formula in the column following below steps.
    1. Click +Add a Row button
    2. Focus on the cell on column L (I assume you want to set your formular on this column).
    3. Input ="your form title" into the cell
    Then after you received a submission, the form title would display in the related cell in each row.
    Hope it will help you.
    Thanks,
    Ying

  • Delay in the Response Group Rining / Call Pickup from another Extension

    Dear All,
    We have just finished a deployment of Lync 2013 with Sonus 1000 as the Mediation Gateway, we have deloyed polycom VVX 600 phones,
    We have two lines E1 and 5 Fxo lines (with same Pilot Number)
    I would like the Receptionist to have both E1 DID number and FXO number and her phone to ring when the calls comes from DID line as well as FXO,
    I have the below scenario
    1) Currently the setup is that Receptionist is configured with the E.164 DID number : (Line URI is Tel:+971XXXX500;ext=500), which work perfectly fine
    2) We have added receptionist in Response Group , and setting are (Formal,10 sec , Attendant)
    The issue :
    1) Call forwarding does not work on Response Group (which is by design it self)
    2) When a call comes from the outside to FXO it goes to response group , (there is Music played and the ring on reception is delayed by 2-3 secs) ,
    Customer does not want this delay , it should ring immediately with no music,
    3) If the receptionist moves from one location to any other location to another , she should have the ability to remotely perform call forward to that extension by simply dialing few codes on the phone ( I already told customer
    about PIN based authentication, by customer does like the idea of signing in or signing out)
    In DIRE NEED OF HELP,
    Regards,
    Hasan Reza,

    Hi,
    Did the issue only happen for IP Phone in Response Group or also happen for Lync client in Response Group?
    If the issue only happen for IP Phone, it seems to be an known issue. Please Make sure Lync Server update to the latest version and then test again.
    Here are several similar case may help you:
    https://social.technet.microsoft.com/Forums/lync/en-US/196375a5-3ae9-4452-acbe-2679a8deef80/delay-when-response-group-calls-are-answered
    https://social.technet.microsoft.com/Forums/lync/en-US/70306bf5-fcd3-488a-b6f4-2eee1bcc0457/lync-2010-ip-phone-calls-and-response-group-delays
    Best Regards,
    Eason Huang
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Eason Huang
    TechNet Community Support

Maybe you are looking for

  • To capture the Mini-DV file through the 1394 firewire card from t

    hii there! first let mi make you understand what we people are doing .... We people want to capture the Mini-DV file directly through the 1394 firewire card from the sony camcorder in to the MPEG2 format. Thent on the fly(i.e.during capturing into MP

  • How do i import photos from e-mail to iphoto

    How do I inport 25 photos from my e-mail  to iphoto?

  • Look for a good Java Book

    Hello, I m looking for a good java book. I know already about java In general:GUI,SWING ,applet and all basics things. i would like to buy a more advanced book. Any idea? Since all those books are expensive, i want to buy only one book a very good on

  • Link Between LIPS, VBFA and EKKO

    Hi All, I've a requirement where in i need to extract the data from LIPS based on EKKO. while extracting the data from LIPS i need to check VBFA and then VBFA with EKKO. please let me know is there any relationship between LIPS, VBFA and EKKO. REgard

  • Error Message 1 (121) 611-611

    Suddenly I am unable to text one person who is in my address book (also an iPhone user on AT&T). Phone number is entered correctly (10 digit) and he can text me. However each time I try to text, I get an error message back with the above number and m