Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

run with different OI accounts

Sorry, I just cant get my head around this.
I know I can create separate 'key's in the registry under OECGI4, then I create the same key in IIS as all per the oecgiapi instructions.
the frameworks APIs I have created are in an account that is inherited by another account, that same APIs are to be used.
The registry is setup to use one account and another entry setup is another OI account.
the url I am using for the first one is - localhost/api/myapp/ which 'automatically' uses the first registry one i setup.
How do I then get to use the second one (for a different OI account) - is there a change somewhere in the url / IIS setup.

This would not be an issue on a live site as they would be setup for the account that is theirs.
Of course I am trying to test each one on the same server, maybe not possible, maybe have to keep changing the account in the first setup - just looking for advise on the best direction to take.

Hope I have explained this correctly and the 'issue' is obvious if not explained well

Comments

  • What is the path to the second URL without any URL rewrite rules. i.e. localhost/cgi-bin/myapp2/oecgi4.exe ?

    If you are using rewrite rules, what is the path to the same app with the rewrite rules. i.e. localhost/api2/myapp ?
  • edited April 2022
    Only one rewrite rules setup:
    <rules> <rule name="Root API" stopProcessing="true"> <match url="^api$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="oecgiapi/oecgi4.exe" /> </rule> <rule name="API" stopProcessing="true"> <match url="^api([_0-9a-z-/]+)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="oecgiapi/oecgi4.exe/{R:1}" /> </rule> </rules>

    localhost/api/myapp/[resource]

    oecgiapi is also the registry entry
  • edited April 2022
    Ideal setup:
    Registry=

    LANoecgiapi
    FESoecgiapi

    then a url that will use the correct one, but still use the same HTTP frameworks setup
  • This isn't exactly what I was looking for but I think I can answer your question based on intent and the information provided.

    For the sake of discussion, I'm going to rename LANoecgiapi to lan-oecgiapi and FESoecgiapi to fes-oecgiapi. The reason is the name is important and sometimes URLs can be case sensitive so it's best to use all lower case when possible.

    If the images below are too hard to read please right-click on them and open them in a new tab/window to see the full image.

    So let's start with the IIS virtual directory. You should have two virtual directories similar to the image below. Both virtual directories can point to the same physical directory. The important thing is the name must be different because it's this name that ties it to the registry settings.


    You'll need to go through and make sure OECGI4.exe is allowed to execute in both virtual directories by ensuring the ISAPI restrictions and handler mapping settings allow it to execute.

    The next key part is the registry. The name of the registry branch under OECGI4 must match the name of your virtual directory. For example, the image below shows the virtual directory name corresponding to its registry settings, and then the login attempt in the OEngine debug window when the URL http://localhost/lan-oecgiapi/OECGI4.exe/ping is accessed.


    And here is the same screenshot for the FES API when the URL http://localhost/fes-oecgiapi/OECGI4.exe/ping is accessed


    Here is a summary of the order of events:
    1. The request comes into IIS, i.e. http://localhost/lan-oecgiapi/OECGI4.exe/ping.
    2. IIS located the virtual directory.
    3. IIS runs OECGI4 (if allowed).
    4. OECGI4 looks in the registry for a branch that matches the path name (i.e. lan-oecgiapi) of the virtual directory.
    5. OECGI4 uses the settings in the branch to try and connect to the OEngineServer.

    If you can get this working then you've proven that different APIs are logging into OI with different credentials and the last step is to setup the rewrite rules.

    I haven't tested this out but your REWRITE rules should look something like this for the LAN application:

    <rules> <rule name="LAN Root API" stopProcessing="true"> <match url="^lan-api$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="lan-oecgiapi/oecgi4.exe" /> </rule> <rule name="LAN API" stopProcessing="true"> <match url="^lan-api([_0-9a-z-/]+)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="lan-oecgiapi/oecgi4.exe/{R:1}" /> </rule> </rules>

    And for the FES application:

    <rules> <rule name="FES Root API" stopProcessing="true"> <match url="^fes-api$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="fes-oecgiapi/oecgi4.exe" /> </rule> <rule name="FES API" stopProcessing="true"> <match url="^fes-api([_0-9a-z-/]+)$" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> <action type="Rewrite" url="fes-oecgiapi/oecgi4.exe/{R:1}" /> </rule> </rules>


    This should allow you to access the URL:
    http://localhost/lan-oecgiapi/OECGI4.exe/ping
    with:
    http://localhost/lan-api/ping

    And the URL:
    http://localhost/fes-oecgiapi/OECGI4.exe/ping
    with:
    http://localhost/fes-api/ping

    This should wrap up the process.

    It is possible to have the rewrite rules be something other than 'lan-api' and 'fes-api' if the rewrite rules are changed but I don't want to complicate the example.
  • @JaredBratu @DonBakke
    Thank you. That makes it easy to follow and understand.
    Also thanks for some of the 'workings' explanations as I wondered how it all connected.

    BUT , one thing, you notice that this is posted under the HTTP Frameworks section.
    The instructions and setup in the http setup is localhost/api/myapp/
    Is it http://localhost/fes-api/api/ping - any adjustments to rewrite rules required?

  • First lesson, never Ass U Me

    Ok, for some reason this works.
    http://localhost/fes-api/ping

    Thank you linesman, thank you ball boys.
  • Here for the benefit of others following.
    You do need to change the HTTP Frameworks settings for the API url, in this case, /fes-api.
    The reason being, is that when you use ParentUrl to form a href-link localhost/api/myping is what you end up with, which should be localhost/fes-api/myping.
    There is a HTTP_FRAMEWORKS_SETUP 'record' for each OI account (which I learnt the hard way - why am I getting 'method not allowed'!!! - sort of a bummer as any change that is 'global' needs to be done in each account - but at least this version has saved us heaps of time in other areas)
  • why am I getting 'method not allowed'!!!

    Is this an actual question or are you referencing something else in context?
  • LOL, no, it was my musings at the time, soory, should have put " around it.
Sign In or Register to comment.