CEMT over Middle Tier

For complex topics that regular users would not be interested in. For power users and database administrators.

CEMT over Middle Tier

Postby Ardavan » Sat Jan 26, 2019 6:06 am

Hello,

Firstly I'd like to praise the OpenDental team for your work on the CEMT, we've had our eyes on it since first release and can see the improvements with every iteration. The issue I'm reporting may already have been resolved as we're lagging a bit (still on version 18.2.47) but I cant seem to get the CEMT to connect over the middle tier.
The problem may actually just be a misconfiguration of mine, I can't find any documentation for using the CEMT over middle tier. When I remove the database connection setting from the CentralManagerConfig.xml file it throws an error, if I leave the database connection settings blank it throws an error, if I use a bogus value for the database connection it throws an error, and when I use a correct database setting it just connects directly via database instead of middle tier. I have added the middle tier connections, and if I rename CentralManagerConfig.xml to the FreeDentalConfig.xml (or whatever the filename is, I don't remember now) then the normal OpenDental application can connect to my CEMT middle tier, indicating to me the issue is likely with the client (CEMT application) and not the middle tier server (which the regular OD application can connect to over the middle tier).
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby jsalmon » Mon Jan 28, 2019 11:10 am

I need to do some testing to make sure Middle Tier is working correctly but assuming that it is, you need to make sure you have an XML node called "MiddleTierAddr" which is where you'll enter your URL / URI for the CEMT Middle Tier web service.
https://www.opendental.com/manual/cemtsetup.html
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com
User avatar
jsalmon
 
Posts: 1486
Joined: Tue Nov 30, 2010 1:33 pm

Re: CEMT over Middle Tier

Postby Ardavan » Mon Jan 28, 2019 11:28 am

Thank you, I had missed that very important line in the documentation!
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby jsalmon » Mon Jan 28, 2019 11:29 am

Verified that v18.4 allowed me to connect to a Middle Tier CEMT. I didn't have time to click around at all so you might stumble upon some bugs (not very many people use the CEMT via MT). The config file logic is written in a strange way in the sense that it requires the other XML nodes to be present so make sure to follow what the aforementioned page I linked to above when it says
... Add it directly under the password node.

All other XML nodes can be blank but need to be present for whatever reason.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com
User avatar
jsalmon
 
Posts: 1486
Joined: Tue Nov 30, 2010 1:33 pm

Re: CEMT over Middle Tier

Postby Ardavan » Mon Jan 28, 2019 11:45 am

Thanks, you are correct, with the node you mentioned added I was able to remove the contents of the database server, username, and password nodes and the client did not throw an exception!
Now I am getting the following error:

https://pasteboard.co/HYzEaUBm.png


I'm searching all XML files for that IP address, hopefully its just another configuration of mine.
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby jsalmon » Mon Jan 28, 2019 11:49 am

Let me know what action you were taking prior to getting that error if you need any help tracking it down.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com
User avatar
jsalmon
 
Posts: 1486
Joined: Tue Nov 30, 2010 1:33 pm

Re: CEMT over Middle Tier

Postby Ardavan » Mon Jan 28, 2019 12:07 pm

Thanks, the error pops up immediately after logging into the CEMT over middle tier before interacting with anything, however I have isolated the issue to our CEMT middle tier setup because when I point the CEMT client to the middle tier of one of our actual OD databases it connects fine without throwing any errors. I'll post whatever I learn here for future reference.
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby dgraffeo » Mon Jan 28, 2019 1:24 pm

CEMT over Middle Tier is a tricky beast. The Middle Tier asks for credentials up front - When a query is about to be run the middle tier goes "Hey, what's your credentials?" and we use the currently logged in user which may be DavidCEMT with a password like CEMTPass1234. This is fine, but if those credentials haven't been synced to the server we're connecting to, middle tier will go "HEY I DONT KNOW YOU" and toss it out on its bum. Now then the tricky part comes when we're trying to sync users and passwords over middle tier. Imagine a scenario where we have a brand new database over middle tier that doesn't have any users or passwords except the default. We want to sync user information to it so we can log in! However, the same issue applies - We attempt to send over the username and password information through the middle tier to the remote server but the middle tier asks for the user and password up front in order to do these transactions. We supply it with our user and password, which haven't been synced yet, and the middle tier has a fit and shuts it all down.

So, this is a known issue, what can we do about it? We can't have credential-less queries being run on the middle tier because that would defeat its entire purpose. That would make it insecure. So for the time being there has to be this weird thing where the user in the CEMT and the middle tier database need to be inserted manually first (with same username and password), then that user used to perform the first sync over middle tier to sync the rest of the CEMT credentials.

Needless to say, syncing user credentials over middle tier that don't exist yet is a difficult issue but we're working on it!
"To understand what recursion is, you must first understand recursion."

David Graffeo
Open Dental Software
http://www.opendental.com
User avatar
dgraffeo
 
Posts: 147
Joined: Wed Sep 24, 2014 3:19 pm

Re: CEMT over Middle Tier

Postby Ardavan » Thu Feb 14, 2019 4:13 pm

Thanks for your help guys, we're making progress! I am able to connect the CEMT to the middle tier of a running OpenDental instance with no errors, so the problem must be with my configuration of the CEMT middle tier instance and/or somewhere in the CEMT database. After launching the CEMT and entering the middle tier URI, my username and password I am presented with:

Server was unable to process request.--->
There is an error in XML document (1,419).--->
Unable to connect to any of the specified MySQL hosts. --->
One or more errors occurred. --->
No connection could be made because the target machine actively refused it 192.168.10.10:3306

which makes sense given that it's querying mysql at an IP address that doesn't have a mysql server running. It is referencing an XML document at (1,419).

Before I was getting a similar error but with a different IP address. After disabling a virtual network adaptor with the offending IP address on the middle tier server the IP in the error changed. The IP it is trying to access is that of the Middle Tier server, which was also the database server up until August of last year. I have updated the XML files to point to the new database server (OpenDentalServerConfig.xml, and just for good measure also FreeDentalConfig.xml and CentralManagerConfig.XML on the middle tier).

Any ideas?
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby cmcgehee » Thu Feb 14, 2019 6:49 pm

Sometimes my middle tier server doesn't get changes I made from editing the config file. Restarting the app pool or the entire IIS server usually takes care of it.
Chris McGehee
Open Dental Software
http://www.opendental.com
User avatar
cmcgehee
 
Posts: 577
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: CEMT over Middle Tier

Postby Ardavan » Thu Feb 14, 2019 11:07 pm

Thanks for the tip, I really appreciate you guys helping me troubleshoot. Taking your suggestion I discovered the conveniently named iisreset command which helped me move one step further, as you pointed out the changes to the XML files were not always applied immediately so results from previous testing were unreliable.
On a working middle tier I modified the OpenDentalServerConfig.xml to point to the CEMT database instead, then after running iisreset (I had to do a reset for the changes to take effect) I was able to successfully connect the central manager to the CEMT database using the middle tier. I then copied this working instance from "C:\Program Files (x86)\OpenDental\" to "C:\Program Files (x86)\Open Dental CEMT\", created a virtual directory in IIS pointing to it, and did an iisreset, but lo and behold this resulted in the same error. Next I'm going to try from another machine just to rule out the possibility of there being an undocumented conflict when running two instances of middle tiers pointing to different databases on the same machine.
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am

Re: CEMT over Middle Tier

Postby cmcgehee » Mon Feb 18, 2019 9:15 am

I think that when you're hosting two different middle tier instances on the same machine, you might need to change the ApplicationName node in the OpenDentalServerConfig.xml to be unique for each instance. Here's how my file looks:

Code: Select all
<?xml version="1.0"?>
<ConnectionSettings>
  <DatabaseConnection>
    <ComputerName>localhost</ComputerName>
    <Database>development191</Database>
    <User>root</User>
    <Password></Password>
    <UserLow>root</UserLow>
    <PasswordLow></PasswordLow>
    <DatabaseType>MySql</DatabaseType>
    <ApplicationName>/OpenDentalServer</ApplicationName>
  </DatabaseConnection>
</ConnectionSettings>


The ApplicationName should match the name of the application in IIS.
Chris McGehee
Open Dental Software
http://www.opendental.com
User avatar
cmcgehee
 
Posts: 577
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: CEMT over Middle Tier

Postby Ardavan » Tue Feb 19, 2019 5:28 am

Thank you, I was not aware of the ApplicationName node and will use it moving forward.

By chance I happened to stumble upon the problem, and was able to replicate it on other rigs and setups as well.

The middle tier path/virtual directory or whatever IIS calls it cannot be named "CentralManager". I'll leave figuring out why as an exercise for the more curious than I, but for now I"m happy having found the problem and obvious workaround (name it something else).

Thanks again for all your help in troubleshooting, I learned about a new XML config, IIS caching, and the iisreset tool!
There are 10 types of people in this world, those who will laugh at this joke, and those who won't. ~Annonymous Bug Writer
User avatar
Ardavan
 
Posts: 104
Joined: Sat May 15, 2010 9:10 am


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 3 guests

cron