How to get the Response Code when a URL is launched from Web Dynpro

Hello Experts,
I have a Web Dynpro Application in which in one of its views i have an IFrame UI element in which i will show a resource stored somewhere ..
But before showing it i want to check if the resource actually exists. For this i have to check the HTTP Response code from Web Dynpro Application without setting it in the Iframe..
I am using the following code to get the Response Code:
URL url = new URL("Some Url");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
wdComponentAPI.getMessageManager().reportSuccess("Response code ="+connection.getResponseCode());
}catch(Exception e){
Now the Problem is whatever response Code occurs 403 (for No Proper Authorization), 404 (for Resource not found) etc..
i always get Response Code=  500 (which is for Internal Server Error) shown in the messgae i have printed.
Please let me know the correct way of getting the Response Code from Web Dynpro.
Also my resource is lying on a SAP Portal 6.4
Best Regards
Edited by: Sundeep Sethi on Feb 18, 2008 9:07 AM
Edited by: Sundeep Sethi on Feb 18, 2008 10:23 AM

  Check this code from /thread/5242768 [original link is broken] if it works.
URL myurl = new URL("");
URLConnection connection = myurl.openConnection();
if(connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) connection;
System.out.println("Response = "+httpConnection.getResponseCode());
catch(Exception e) {
// print exception
Harini S

Similar Messages

  • How to get the itunes code of iphone 5s

    how to get the itunes code of iphone 5s
    I am from india ....
    the itune setting doesnot give me none option in my phone ....
    And i dont know the itunes gift code ...
    So pls give me the detail how to get the itunes code and what is it ?

    It would have been better if you had added a reply on your original post instead of starting a new thread :
    iTunes gift cards are an alternative way of paying for content from the store, but they aren't available in all countries (and the cards are country-specific, they can only be used in their country of issue). The gift card field on the account set up page is optional, and as gift cards aren't available in India you won't be able to fill it in anyway.
    There are instructions on this page for how to create a new account without giving credit card details and will give you the 'none' option : - the instructions won't work with existing accounts, and if you didn't use those instructions when creating your existing account then you will need to enter credit card details before you will be able to use it to download content

  • How to get the Useru2019s position when the user doesnu2019t have CP relation

    We have a custom program which will add / delete attributes (In transaction PPOSA_BBP). It is working fine for users which were assigned with CP relation But it fails for users which doesnu2019t have CP relation (since we are getting the position of users form HRP1001 then we are retrieving the existing attributes based on the position after that updating the attributes) as we are getting the position from HRP1001 it fails for users were no CP relation.
    Help us how to get the Useru2019s position when the user doesnu2019t have CP relation. Suggest us any function module or how to query the HRP1001 or some other table if exists

    Hi Paul,
    Have a look at these tables.
    Using table BUT000 the central business partner data are stored, f.e. partner type, partner names, partner number, partner guid, person number, etc. In table BUTBKK the bank data to a business partner are stored.
    Central business partner address data
    The table ADRC is used for the address of a business partner. Table BUT020 links the business partner number with the address number. Using table BUT021 several addresses to a business partner with different usages (modes), f.e. correspondence or delivery address, can be stored. The personal data of a business partner person are stored with key person number in table ADRP. The person number is assignd to a business partner person in table BUT000. Communication data of business partners as e-mail, telephone, fax, etc. are stored in the tables ADDR1 u2013 ADDR12. The business address of a contact person or an employee consists of the organization address (company resp. org.-unit) and of an address addition, which describes f.e. a building, a room number, etc. The address addition is stored in table ADCP and is identified by the keys address number of the organization address and person number.
    Relationships between business partners
    Table BUT050 contains the relationships between a business partner organization and a business partner person using relation types. The relation types are defined in table TBZ9, f.e. the relation type u2018has employeeu2019 corresponds to identifier u2018BUR010u2019, the relation type u2018has contact personu2019 corresponds to identifier u2018BUR001u2019. Table BUT051 stores communication data of a contact person relationship (compare to table ADCP). Table BUT052 stores several address numbers to one business partner relationship (including a standard flag).
    Hope this helps,
    Kind Regards,

  • How to get the source code of Java Concurrent Program?

    How to get the source code of Java Concurrent Program?
    Programe Name:Format Payment Instructions
    Executable:Format Payment Instructions
    Execution File Name:FDExtractAndFormatting
    Execution File Path:oracle.apps.iby.scheduler
    Thanks in advance,

    Go on Unix box at $JAVA_TOP/oracle/apps/iby/scheduler
    You will get class file FDExtractAndFormatting.
    Decompile it to get source code.
    Thanks, Avaneesh

  • How to get the source code of a PRT application in the portal

    Does anybody know how to get the source code of a PRT application in the portal?
    Thanks in advance,

    If its Java-based code have a look at the properties of an iView that belongs to the application in question and copy the value of the Code Link parameter e.g. ''.
    Search the Portal installation directory under /j233/cluster/server/ for a .par.bak file of the same name, removing .default from the codelink parameter
    Copt this locally and import into Netweaver Developer Studio. You will have to decompilte the class files with a decompiler such as DJ Decompiler or Cavaj (search with Google).

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • How to get the java code of the message mapping

    how to get the java code of the message mapping,
    I mean to ask how to get the background java code of the message mapping(graphical mapping).
    And where to view it?

    Hi Satya,
    The JAVA code for graphical msg mapping is in below folder:
    Here all the mapping jars are there in this folder.
    Just decompile these jars and you can see the code.
    Rajeev Gupta
    Message was edited by:
            RAJEEV GUPTA

  • Where to  find the pcui_gp  components ,How to get the source code of those

    Hi All,
    Can anybody tell the exact location wher the pcui_gp components will be stored if they are  not appearing.
    And another question is how to get the source code of the pcui_gp for customization.
    anybody working on these compoents please help me.
    answers will be rewarded.
    thanks and regards,

    Hi Arun,
    I am unable to see the pcui_gp components in the DTR ,I require this in order to get the source code of one of its component.
    Can you please tell me the step by step procedure getting those pcui_gp components from J2ee engine to the  dtr or  NWDI.
    If there are any documents on pcui_gp components exclusively please do forward to my mail id [email protected]
    Thansk and Regards,

  • How to get the search option when we are creating new view

    How to get the search functionality when we are creating new view.
    Ex:- if we see the standard component BT112S_SC. Under this
    AdvancedSP  is the view,
    same kind of view if i want to create new view with same bol entity in my new component. I am unable to get that search functionality.
    for search functionality,,i think view should inherit the super class CL_BTSRV_ADVS_CNTRL, but in my new view controller class, i am unable to find this class.
    Can anybody give me some inputs on this.

    In case you are still not able to proceed please refer the following blog.

  • How  to get the java code of the standard functions

    How  to get the java code of the standard functions in xi
    Example , hoh get the java code for a node function - removeContext.

    Click on the Standard Function.
    Hold Ctrl+Shift
    right click on the standard function to view the context menu. You will see options to view the source code by exporting

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns=""
    xsi:schemaLocation=" List_AML_Finacle.xsd">

    avoid multi post

  • How to get the Status code of rwclient when run as a background job

    Hi all,
    i have to get the return code(status code) of the rwclient.exe while running as a batch script. is it possible to get the return code to check whether the report generated succefully or not?
    please help me if anyone has the solution.
    Thanks in advance

    Hi Andi,
    Please see my Blog : /people/dhanabal.thangavel2/blog/2009/12/16/getting-daily-failed-message-list-in-xi-and-sending-an-alert-mail-with-attachementcsv-file-of-that-list
    I think it 'll help you on this.

  • I am getting ready to wipe a PC clean but wanted to know how to get the activation code for the Version of Adobe reader that is currently installed on the PC?

    I do not have the activation code for this PC and need to know how to get the software loaded back on it after a clean install of the OS and other programs.

    If you use any additional subscription services to Adobe Reader, they are activated with your Adobe ID & password.

  • How to get the full pictures, when only a strip of it is seen?

    When Yahoo India web page is viewed through Mozillz firefox 4.0.1 the photos in the gallery are seen only as a small strip and not fully. How can I correct this defect?

    1. I want to get the mail statuses of the invoice mail sent to a customer.
    2. In which table the log will be stored ?
    3. How to get the link for the billing document for which the mail was sent to the customer ?
    What do you mean?
    How do you manage the mail?
    I suppose you manage it by a messages, if it's so you can have 2 different status:
    - One for the message: check table NAST
    - One for mail: see transaction SOST
    The link is in NAST table

Maybe you are looking for