Topic
4 replies Latest Post - ‏2012-11-29T23:20:06Z by SystemAdmin
SystemAdmin
SystemAdmin
9029 Posts
ACCEPTED ANSWER

Pinned topic REST builder doesn't like indirect references for credentials

‏2012-11-29T21:05:00Z |
Greetings. I have a simple model which makes a rest call. This works great if I hard code the ID and password. However, if I use variables, then I get an HTTP 401 Unauthorized response.

I'm attaching the model; the REST call is to greenhouse so it should be available to anyone. Just edit the variables to put in your own ID and password.

Maybe someone can tell me what I'm doing wrong!
Updated on 2012-11-29T23:20:06Z at 2012-11-29T23:20:06Z by SystemAdmin
  • mburati
    mburati
    2549 Posts
    ACCEPTED ANSWER

    Re: REST builder doesn't like indirect references for credentials

    ‏2012-11-29T21:33:43Z  in response to SystemAdmin
    Darren,
    Hopefully someone can take a look at this soon, but here are a couple questions and some info which may help.

    Which version of WEF (including fixpack level) are you using?

    To use an indirect ref for creds for builders like this, you typically want it to use that (and often from credential vault or somewhere secure, not a variable value - so assuming that's just what you're using for a sample here), BUT that's more for "runtime" not necessarily the regen creds that it'll use to generate the schema that you want to cache in the model...

    Here's what's typically recommended for that type of situation:
    
    - In the Auto-Generate and cache schema section of a REST builder where you need to pass creds or a dynamic parameter of some kind,  enter the Sample Data URL to use 
    
    for Design-time regen,  check the 
    "cache schema" input, and enter your creds or 
    
    static parameter value and click ok.  It should generate the model based on the sample URL and the sample creds (instead of the runtime creds) and save the schema it generates in the model XML.  Then clear the sample username/password and save again, so your username/password won
    't be in the model (I believe that builder only re-caches the schema if a builder input that affects the schema is then changed, not if you remove sample creds).   Here
    's the doc from the REST Service Call builder explaining that set of steps:   Select 
    
    this input to enable caching of the generated result schema. Using 
    
    this input, you can avoid doing an HTTP request to the service during every model generation. The cache key is made by using the following builder inputs: URL, HTTP Request Type, Restructure Feed Data, and Include Attributes. If you change another input that effects the structure of the result data, clear 
    
    this input, perform a regeneration, and set 
    
    this input again. Setting 
    
    this input provides the following benefits:   Enhanced performance This helps during editing models that contain 
    
    this builder.   Enhanced security A cached schema avoids exposing model generation time credentials after you perform an initial regeneration. To leverage the security, set 
    
    this input, enter the required credentials, and click OK. After you regenerate and save your model, clear your Sample Data Parameters from the builder inputs. The schema is now cached.   This input is available 
    
    if the Auto Create Schema input is selected.
    


    I hope that info helps,
    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: REST builder doesn't like indirect references for credentials

      ‏2012-11-29T21:43:54Z  in response to mburati
      Hi, Mike. Version info:

      Version: 8.0.0.1
      Build id: WEF8.0.0.1_20120815-0935

      Yes, these variables were just to demonstrate the apparent bug. I had used a property file in my first iteration, and imported it with an Import to XML builder. I took that out to remove any question about whether the builder had access to the variables.

      Note: When I replace the hard coded values with variables and click Apply, I get a pop up in Eclipse asking for my ID and password. I'm guessing that's so I can work with this builder without having to enter any credentials....nice.

      Also note: When I run this model with the variables in place, I get the error right away -- before I'm presented with the list of operations to select. I guess the test harness for the Service Definition is somehow invoking the builder...or maybe generating the builder actually invokes it. Either way, it's unexpected and may have undesirable results.
      • mburati
        mburati
        2549 Posts
        ACCEPTED ANSWER

        Re: REST builder doesn't like indirect references for credentials

        ‏2012-11-29T22:10:26Z  in response to SystemAdmin
        Darren,

        That's what I see too if I run it the way you had it, but if I follow the directions I posted above, with your model (using the sample data URL and sample creds in designer, with cache schema and include attributes checkboxes checked, then it works as expected.

        I hope that info helps,
        ..Mike Burati
        http://www-10.lotus.com/ldd/pfwiki.nsf/
        The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
        • SystemAdmin
          SystemAdmin
          9029 Posts
          ACCEPTED ANSWER

          Re: REST builder doesn't like indirect references for credentials

          ‏2012-11-29T23:20:06Z  in response to mburati
          Thanks, Mike!