IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Javscript variable into pipeline

    Posted Fri May 28, 2004 01:16 PM

    I have a .dsp application that works just fine. BUT the client wants to run this behind a portal applpication with a single sign-on

    I have set my application (all .dsp and services) to Anonymous ACL and when I access it does not request username/passw.

    OK so far, but my app needs to know who the logged on user is, I was using the PSUtilities.misc:getUser service.

    The solution we have designed is that the portal already stores the userid (I am not bothered about pasww) in a cookie.

    I can read the cookie in javascript at the start of each .dsp page, and want to extract the userid to pass to my app as a pipeline variable

    My question is, I can disply the extracted userid using document.write(userid); in the javascript. How do I get this variable into the pipeline or the form so I can pass it to a bc service. if outside the script tags I do %value userid% it displays nothing

    graham moisley


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 2.  RE: Javscript variable into pipeline

    Posted Fri May 28, 2004 03:26 PM

    Just off the top of my head…I can think of a couple of ways to get the userid on the “pipeline”.

    1. After retrieving the userid from the cookie, you could set a hidden field in your form equal to the value of the userid. Then, when you submit the post in your form tag, the userid will be available on the pipeline.

    2. After retrieving the userid from the cookie, call the next page (or simply refresh the current page) and pass it along as a parameter. For example:

     
    var userid = "foobar"; 
    var pageurl = "mypage.dsp"; 
    window.location.href=pageurl + "?userid=" + userid; 
    

    HTH


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Javscript variable into pipeline

    Posted Fri May 28, 2004 03:53 PM

    Graham,

    You can do as Chris suggested. Additionally you can call or invoke the service from mypage.dsp using:

    %invoke myService%
    %endinvoke%

    Your “userid” is available in the pipeline for you to access. From a java service you can access the value by referring to “userid”. In case of a flowservice, you will need to declare an input field with name “userid”.

    Let us know how you go with it.

    Amith


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: Javscript variable into pipeline

    Posted Fri May 28, 2004 05:06 PM

    Chris and Amith, thanks for the quick responses.

    I think I need to follow chris’s advice, and almost put a dummy page to read the cookie, set the variable and call my regular page

    Amith, my page does an %invoke myService% %endinvoke%, but what I think is happening is that that is executed by the server, then the html is passed to the client which executes the js to resolve the userid. So although in my .dsp the js and document.form.userid.value sets up the variable correctly, in fact the service I am logically passing it to has already been executed.

    I think I understand, so am planning to have a dummy page to determine the userid, and pass it in the url as per Chris, to the actual page.

    Or does anyone know a better solution

    thanks for the pointers guys

    regards

    graham


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 5.  RE: Javscript variable into pipeline

    Posted Fri May 28, 2004 06:31 PM

    You are correct in your understanding that the invoke is being executed on the Integration Server before the HTML is returned to the client and the JavaScript is executed by the Browser.

    When you need to pass parameters to a DSP you need to get then onto the URL. Using the “build-the-url-in-another-page-and-then-HTTP-redirect” seems like a reasonable solution to me.

    Cheers,
    Fred


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods