Urgent :Fetch Portal URL in WebDynpro code

Hi techgurus,
I want to fetch portal URL/ Portal system ID in my webdynpro code?
Please help!
Regards,
Abhishek

This is an approach we have implemented:
Login to Visual Administrator.
Go to Services –> Destinations
Create HTTP Destinations for the URLs to be accessed.
Write a method containing the below code to access the same URL:
     InitialContext ctx;
     Object obj;
     DestinationService dstService;
     Destination destination;
     HTTPDestination httpDestination ;
     HttpURLConnection httpurlconnection = null;
     Properties destprop = null;
     String username = "";
     String password = "";
     try
          ctx = new InitialContext();
          obj = ctx.lookup(DestinationService.JNDI_KEY);
          dstService = (DestinationService) obj;
          List destinationList = new ArrayList();
          destinationList = dstService.getDestinationTypes();
          destination = dstService.getDestination("HTTP",<name of the HTTP url>);
          destprop = destination.getDestinationProperties();
          httpDestination = (HTTPDestination) destination;
          url = httpDestination.getUrl();
     catch(Exception ex)
          wdComponentAPI.getMessageManager().reportException("Unable to get the Webservice URL "+ex.getMessage(),true);
          ex.printStackTrace();
Hope this solves your problem.

Similar Messages

  • Getting the Portal URL in the code

    Hi All,
    Is it possible to get the URL of the Enterprise Portal (http://<host>:<port>/irj/portal) in the web dynpro code?
    Actaully i am sending mails from my application to various users and need to include the URL of the Enterprise Portal in the mail.
    How to go with this? Any ideas?
    Thanks,
    Venkat

    Hi,
    If you build the mail message from your dynpro application than you can use this code to get the server name and port:
    String hostName = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();
    int port = TaskBinder.getCurrentTask().getProtocolAdapter().getServerPort();
    String url = "http://" + hostName + ":" + port + "/irj/portal";
    Hope it helps,
    Roy

  • Determine own Portal Navigation URL within WebDynpro iView?

    Hello all,
    we do integrate WebDynpro-Java applications in the portal. These applications do run on the same J2EE-engine as the portal (NW04).
    The WebDynpro application now should be enabled to determine its own portal URL for deep navigation to this iView. We want to hand this URL over to another (non-portal) web-application. This application will then e.g. provide a back button to allow the user a consistent way back to where he left the portal.
    Is there a way to get the portal URL out of the portal context if the iview is a WebDynpro application?
    Thanks a lot for your answers.
    Lutz

    Hi,
    The referer should not contain the link of the webdynpro app, rather it should contain the url of the page that called the webdynpro app. So if you have a link at http://www.google.com which points to www.bouvet.no , the referer found in the code at www.bouvet.no will have the value www.google.com (ref http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z14) . If this is usable in your case, depends on what urls the innerpage uses, and wheter the iview frame creates an extra redirect which ruins all data.
    Another possibility would be to extend the webdynpro with an iview which first retrieves the current navigation node (you should find several post on how to do this) and then redirect to the webdynpro application with an extra url parameter which you can then retrieve from the HttpRequest in hte webdynpro application. Not 100% sure it will work, and it will create some extra maintenance and complexity.
    Dagfinn

  • How to get password of a logged in portal user in webdynpro.

    hi,
    i want to get the password of the logged in portal user through webdynpro. i already know how to get the user id and other information through webdynpro (using WDClientUser), but i want to get the password as well.
    this is an urgent requirement. Immediate help will be highly appreciated and points will be awarded for helpful answer.
    thanks in advance.

    Hi
    User Management APIs don't give the liberity to obtain the password, instead you can verify a password. Please check if your requrirement can be modified to check for password.
    Please use code mentioned below and the one suggested before.
    loggedInUser = WDClientUser.getCurrentUser();
    user = loggedInUser.getSAPUser();
    if (user != null)
    IUserAccount[] acct = user.getUserAccounts();
    if(acct[0] != null)
    b = acct[0].checkPassword(password);
    Thanks
    Srikant

  • How to catch URL parameter from Portal URL in Web Dynpro iView

    Hi All,
    I have a web dynpro application running as a portal iView successfully. Now the client wants to make it internationalized with 7 languages. Currently they access the portal - and via role assignment they get to the portal tab with the wd iView. Now they want to send a parameter for the language key with the portal URL. So when they are typing in http://myportal.mydomain.com now they want to type in http://myportal.mydomain.com?sap-locale=de or so. My question is how can I catch this parameter in the WD application when it is running inside a portal iView? Is it at all possible?
    I have written a very small application which is trying to catch a URL parameter named PARAM. The code I have written is the default one as below:
    String paramValue = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");
    When I run the application standalone and add the PARAM=something in last of the URL I can catch it. But when I create an iView and while previewing it I add the same PARAM value it is coming as null all the time. Same when I add this iView to a role and show it via role assignment in protal. Please help to let me know how to achieve this. I think if I can read the parameter value from Portal URL in the WD iView - then I can set it as the default locale of the application and then show language specific file to achieve internationalization.
    Your urgent help will be highly appreciated.
    Warm Regards,
    Shubho

    Hi Shubhadip
    Even if you get the parameters, how do you internationalize your application? Are you not following the standard way as described in the following link. In this case you never need to capture any such parameter. This is done by the WD runtime automatically .
    <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/f4/d95664da179b4db731e21c2e470b72/frameset.htm">Internationalization of WD projects</a>
    You can retrieve application parameters specified at the creation of iview by "adding parameters(with the same name as in iview application parameters) to the default plug of the Component Interface View of the WD application". "onDefaultPlug" method of the interface view controller you get these values as parameters, which you can save in the context node of component controller for later use.This is guaranteed to work.
    But again this is not what you want exactly. You want the user to specify the value at runtime. If you have just 7 languages, you can create 7 set of iviews with different application parameter value indicating language key, and assign to 7 different set of roles, each representing one set of users with common language.
    I hope you find a solution.
    Regards
    kk

  • Portal url in workflow

    Hi,
    I have a webdynpro application portal iview. when i preview that application iview it i get an url. i want to bring that url in workflow screen. please suggest any function modules to get the iview.
    My scenario is manager has to approve or reject a request after clicking on the url in the workflow. so kindly tell me a way to get the url from portal and bring it in workflow. Thanks in advance.
    Cheers,
    Bharath
    Edited by: bharath padmanabhan on Jan 3, 2009 1:54 PM

    Hi Bharath,
    > I want to get a url in the objects and attachements part of the mail. I am not able to find a way to attach a url in that part of the mail.
    This issue has been already discussed earlier. Can you please check the FORUM for the same, since I feel that it is not even a week that this issue was discussed.
    You can create a Container Element and Fetch the data of the URL into that. Do the Binding of that WF Container Element with the Objects and Attachments in Mail.
    That might work for you, as I think you should be aware where to fetch this URL from (DB Table)..
    Hope it Helps..!!
    Regards,
    Kanika

  • Fetching a URL  from a socket output or input stream in a proxy server

    We have written a proxy server in java .
    It connects with a client on some local port and forwards the request of the client to main server through socket connections.
    The code is as follows...
    * BasicProxyServer.java
    * A simple multithreaded proxy server.
    * A client connects to theserver. The server starts a
    * separate threads for data flow though two Sockets.
    * The first socket communicates with the socket of the client.
    * The second socket is used to communcate with the main server
    * for which this server is a proxy. The sockets are connected by pipes.
    import java.net.*;
    import java.io.*;
    public class BasicProxyServer {
         private static int serverPort;
         private static String primaryServerHost;
         private static int primaryServerPort;
         // 1st arg: port to listen on
         // 2nd arg: primary server IP
         // 3rd arg: primary server port
         public static void main(String [] args) {
              serverPort = Integer.parseInt(args[0]);
              primaryServerHost = args[1];
              primaryServerPort = Integer.parseInt(args[2]);
              BasicServer bserv = new BasicServer(serverPort,primaryServerHost,primaryServerPort);
    class BasicServer extends Thread {
         private int serverPort;
         private String primaryHost;
         private int primaryPort;
         private ServerSocket servSock = null;
         public BasicServer(int port, String primSrv, int primPort) {
              serverPort = port;
              primaryHost = primSrv;
              primaryPort = primPort;
              start();
         public void run() {
              Socket clientSock = null;
              Socket primaryServerSock = null;
              try {
                   servSock = new ServerSocket(serverPort);
              catch (IOException e) {
                   e.printStackTrace();
              while(true) {
                   try {
                        clientSock = servSock.accept();
                        primaryServerSock = new Socket(primaryHost, primaryPort);
                        PipedInputStream fromClient = new PipedInputStream();
                        PipedOutputStream toMainServer = new PipedOutputStream(fromClient);
                        PipedInputStream fromMainServer = new PipedInputStream();
                        PipedOutputStream toClient = new PipedOutputStream(fromMainServer);
                        Talk clientToMainServer = new Talk(clientSock, fromClient, primaryServerSock, toMainServer);
                        Talk mainServerToClient = new Talk(primaryServerSock, fromMainServer, clientSock, toClient);
                        clientToMainServer.start();
                        mainServerToClient.start();
                   catch (IOException e) {
                        e.printStackTrace();
         // Override finalize() to close server socket
    protected void finalize() {
    if (servSock != null) {
    try {
    servSock.close();
    } catch (IOException e) {
    e.printStackTrace();
    servSock = null;
    class Talk extends Thread {
         private Socket incoming;
         private Socket outgoing;
         private InputStream in;
         private OutputStream out;
         private InputStream from;
         private OutputStream to;
         Talk(Socket inSock, InputStream in, Socket outSock, OutputStream out) {
              this.in = in;
              this.out = out;
              incoming = inSock;
              outgoing = outSock;
         public void run() {
              int aByte;
              try {
                   from = incoming.getInputStream();
                   to = outgoing.getOutputStream();          
                   while(( aByte = from.read()) != -1 ) {     //read from socket
                        out.write(aByte);     // write to pipe`
                        // read the byte from the pipe
                        to.write(in.read());          // write it to the output socket stream
                        to.flush();
                   to.close();
                   from.close();
                   if(incoming != null) {
                        incoming.close();
                        incoming = null;
                   if(outgoing != null) {
                        outgoing.close();
                        outgoing = null;
              catch (SocketException e) {
              // there is one for a closed socket. Seems to have no effect.
              //     e.printStackTrace();
              catch (IOException e) {
                   e.printStackTrace();
    Here,when client gives any URL in the address bar in the web browser the request is forwarded to this proxy server.
    We want to fetch the URL which client enters in order to implement content filtering and also store the most visited sites by each user .
    But we don't know how to fetch the URL from the socket input or output stream.
    Can you suggest any suitable solution for the same??

    Shailesh24 wrote:
    We want to fetch the URL which client enters in order to implement content filtering and also store the most visited sites by each user .
    But we don't know how to fetch the URL from the socket input or output stream.
    Can you suggest any suitable solution for the same??Yes. Write a proxy server that actually speaks HTTP.

  • How to encrypt Password while calling Portal URL from Abap

    Hi all,
    My requirement is to call portal from R/3 4.6C.  As part of it I'm calling Portal URL along with user id & Password by using the FM CALL_BROWSER. The problem here is User ID & Password are visible everyone in the URL.
    Is there any way that I can encrypt sothat it doesn't become a security issue?
    I really appreaciate for your help.
    Thanks
    Seshu

    can you please mention the abap code  by which you are sending the username and password to a portal via url.....
    are you able to log on to the portal...please share your code ......
    Edited by: Ashutosh Shukla on Apr 18, 2008 9:17 AM

  • Accessing portal roles in webdynpro for java

    Hi,
    Please let me know how to access portal roles in webdynpro for java.
    Rgds,
    Patana

    Hi ,
    Please use this API to access the portal roles:
    IRoleFactory fact=UMFactory.getRoleFactory();
    Also see this code to get more information of role using code:
    IRoleFactory rolef=UMFactory.getRoleFactory();
    IRoleSearchFilter searchfilterrole= rolef.getRoleSearchFilter();
    ISearchResult searchResult = rolef.searchRoles(searchfilterrole);
    while(searchResult.hasNext())
    String unq=(String) searchResult.next();
    IRole role1=rolef.getRole(unq);
    String roleName = role1.getDisplayName();
    String roleID = role1.getUniqueID();
    // Once you get the informationof role you can use it in your application as per your requirement.
    Also please note that:
    You should add "com.sap.security.api.jar" to your project`s java build path for getting the Portal Security API's.
    I hope this solves the problem. Please revert back incase you need any further informationon this.
    Thanks and Regards,
    Pravesh

  • Portal url redirect

    Hi All,
    Because of a requirement,  I wanted to retreieve the requestURL and append compnay name to it for identification and redirect the url.
    basically if my portal url is http:
    <servername:port>\irj\portal , then get the hostname and append to portal url at the end as portalurl\hostname and make the request to this url.
    From here onwards this should be portal url throught the session. I am doing like this but it is not working
    String strReqURL = request.getRequestURL().toString()==null?"" : request.getRequestURL().toString();
         if ( strReqURL != null) {
              System.err.println("Before request url is"+request.getRequestURL());
              StringBuffer redirectUrl = new StringBuffer(strReqURL);
              redirectUrl.append("/hostname");
    Please help me out in resolving this issue.
    Thanks
    Supriya

    Hi,
    have you tried to get the HttpServletRequest associated with the IPortalComponentRequest and retrieve the server name from there?
    HttpServletRequest req = request.getServletRequest();
    String server = req.getServerName();
    http://help.sap.com/javadocs/NW04/current/ep/com/sapportals/portal/prt/component/IPortalComponentRequest.html
    http://download.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html
    You could also do this by Javascript and add the JS code to the index.html located at /irj/index.html
    br,
    Tobias

  • Portal URL's rename

    Hi Guys,
    We have a requirement from the client where we need to change/rename the current portal url's.
    And also our's is federated portal where we use EP portal as SSO to connect to BI , SRM & ECC reports.
    EP portal: https://ep.abc.uk.net to be changed to https://ep.def.uk.net
    same way we need to change all the components urls.. like..
    ECC portal: https://ecc.abc.uk.net to be changed to https://ecc.def.uk.net
    SRM portal: https://srm.abc.uk.net to be changed to https://srm.def.uk.net
    Please let us know the procedure if anyone has already worked on this.
    Thanks in Advance,
    Regards,
    Manje
    Edited by: Manje Gowda J on Aug 2, 2010 5:08 PM

    Hello Angela,
    you should find everything you need in :
    - the pdk-java sample 'event form' (eventform.jsp and publicparam.jsp)
    - the pdk articles
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/ADDING.PARAMETERS.EVENTS.TO.PORTLETS.HTML
    (explained source code of the event form sample)
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/primer.portlet.parameters.events.html
    (what to do in portal once your jsp-application is running)
    For your jsps, you'll know how to create the events, th event's parameters, how to call the htmlFrormActionLink() method, and finally get back the params from the request.
    Else, to create a link to a page, use the constructEventLink() in the EventUtils class (see API DOC deployed with JDPK on your OC4J)
    Hope this helps.
    Jean-Roch

  • Portal URL's and Form Posting

    When I use the following url in a form POST method, I receive a "page cannot be found" error when I click submit, but if I go directly to the page by entering the url in my browser, it works. Why is that?
    http://matrix0.dynamex.com:7778/pls/portal/url/page/dxnet_jsps/cr_submit?test=1
    How do I call another page in Portal through a form POST method using JSP?

    Hello Angela,
    you should find everything you need in :
    - the pdk-java sample 'event form' (eventform.jsp and publicparam.jsp)
    - the pdk articles
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/ADDING.PARAMETERS.EVENTS.TO.PORTLETS.HTML
    (explained source code of the event form sample)
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/primer.portlet.parameters.events.html
    (what to do in portal once your jsp-application is running)
    For your jsps, you'll know how to create the events, th event's parameters, how to call the htmlFrormActionLink() method, and finally get back the params from the request.
    Else, to create a link to a page, use the constructEventLink() in the EventUtils class (see API DOC deployed with JDPK on your OC4J)
    Hope this helps.
    Jean-Roch

  • Generate SAP Portal URL in ABAP

    Hi all
    I am faced with a task that involves fetching data from SAP E-Recruiting, and presenting it in an XML document which is indexed by a search engine. The data I extract from E-Recruiting, will be used to display a short listing of available positions in the company on an internal website.
    I am able to extract the data, and present it in XML, but the following is a bit more difficult for me.
    The challenge is this:
    For each position I exctract from E-Recruiting, I need to find a way to generate a complete "portal style" URL. This URL will take users browsing the website, to the E-Recruiting job advertisement in the SAP portal. The SAP Portal will display the complete E-recruiting job advertisement, when the users click a "Read more" link in the short listing.
    An example URL is this:
    http://<i>server:port</i>/sap(bD1lbiZjPTUwOCZkPW1pbg==)/bc/bsp/sap/hrrcf_req_dovr/application.do?BspClient=508&BspLanguage=EN&rcfSpID=0003&PARAM=UE9TVF9IUk9CSkVDVD0wMU5DNTAwMDExNTQ%3d
    I need to do this in "regular" ABAP / ABAP OO programming, not BSP or something like that. Is there some function module that will do this for me? I collect all my information from the tables HRP51* (i.e. HRP5122).
    Any help is greatly appreciated.
    Regards,
    Thomas K
    Message was edited by: Thomas Kjelsrud
    Message was edited by: Thomas Kjelsrud

    the example url you have given is not portal url
    An example URL is this:
    http://server:port/sap(bD1lbiZjPTUwOCZkPW1pbg==)/bc/bsp/sap/hrrcf_req_dovr/application.do?BspClient=508&BspLanguage=EN&rcfSpID=0003&PARAM=UE9TVF9IUk9CSkVDVD0wMU5DNTAwMDExNTQ%3d
    its a bsp url.
    if you want to generate bsp url you can use the following method from your abap program
    DATA:  params TYPE tihttpnvp.
    FIELD-SYMBOLS: <wa_params> LIKE LINE OF params.
    fill params table with other url parameters you want
    like BspClient=508
    APPEND INITIAL LINE TO params ASSIGNING <wa_params>.
        <wa_params>-name = 'BspClient'.
        <wa_params>-value = '508' .
    CALL METHOD
          cl_http_ext_webapp=>create_url_for_bsp_application
          EXPORTING
            bsp_application      = 'HRRCF_REQ_DOVR'
            bsp_start_page       = 'application.do'
            bsp_start_parameters = params " other url params
          IMPORTING
            local_url            = url.
    if this bsp is running inside portal as an bspiview and you want to reach this iview directly from a url then the url is different , it is basically the path of the iview in the Portal Content Directory
    Hope this helps.
    Regards
    Raja

  • Retrieve portal url dynamically.

    Hi,
    Could anybody pls let us know how to identify the portal Url dynamically using a function module or SAP Table?
    We want to put this URL in the notification e-mail so it is dynamic when the object is moved to Quality and production systems.
    Thanks in advance.

    One way to make Portal URL dynamic is to create a ztable with fields ABAP system id and portal URL.
    Select Portal URL from this table based on the sy-sysid.
    By this way you dont have to change your code. Just change table entry on each server.
    Hope this helps!
    Monalisa

  • Dynamically build Portal URL

    Hello experts,
    I'm searching for a possibility to build up dynamically a portal url like this:
    http://<hostname>:<port>/irj/portal?NavigationTarget=navurl://dcaceb3f782aa37c63aedfdc8347c7b5&....
    &CurrentWindowId=WIDDefaultExternal1250835714537&NavigationContext=navurl://39fccbe94b41d07fd15b942490ec5e9e
    The goal is it to start the browser with the seached URL from an ABAP report. How to start the internet browser I allready now. Is there any ABAP class for building such urls with parameter support?
    Thanks in advance.
    Best Regards
    Clemens

    hi,
    this is one [WAY|http://help.sap.com/saphelp_nw04/helpdata/en/d3/ab0b5decd045e482d0deae9f9c90d5/frameset.htm]
    let me know is that ok for u or  ......
    if u r using webdynpro for abap  check for the manus Dua post
    How to open URL IView with dynamic url parameter (navigate_absolute)
    let me know u need more info
    ravidndra

Maybe you are looking for

  • Error Loading Data into a flat file

    I am recieving the following error when loading data into a flat file from a flat file. SQL 2005 is my back end DB. If I cut the file iin half approx 500K rows my ODI interface works fine. Not sure what to look at.. I rebuit the interface which befor

  • After Effects CC version 12.0 is not updating to version 12.1

    Hello: After Effects CC version 12.0 is not updating to version 12.1 on my iMac running Mac OS X 10.7.5. Adobe Creative Cloud desktop version 1.2.0.248 shows that After Effects CC is "Up to date" in the Apps tab; however, it is still version 12.0. I'

  • What is a codepage and how does it work?

    Like any application, DI needs to know which "codepage" to use when processing data. Codepages are character encoding tables. Codepages are necessary because ultimately, all software operates with sequences of bytes, not the actual letters or numbers

  • Picture buttons. How to change?

    Hi all. I have a menu of two buttons. I want tro create the following actions: when the button is active, it should be a text in a frame when the button is not active, it shoul be only the text in a different color. Any suggestion will be helpful. Ex

  • How programmatically set size of report element in Java

    In topic [How programmaticaly set size of some field?|How programmaticaly set size of some field?] someone changing programmatically report element, but I think this part of code is in .NET framework For example I mean something like following snippe