Is there a way to integrate Mx code with services other than webservices?

I am looking for a way to integrate Mx code as the implementation of a service other than a HTTP / webservice! In my case this would be a CORBA service. I can register the CORBA service through a JAVA action which can be initiated at startup. This seems to be no problem. This means that I can register a JAVA service which will get called from the CORBA client. This servicerequest will deliver a CORBA message. How can I integrate this to Mx? In my current thinking the biggest problem seems to be how to create a Mx session from this entry point. What would be the best way?
1 answers

(Assuming you've already found the com.mendix.core.Core.execute method for firing Microflows and the com.mendix.core.Core.create method for creating objects, both these methods will allow you to easily interact with the Mendix DSLs, i.e. getting information 'into' the Mendix database)

You can go two ways with this. Assuming your CORBA service has some kind of authentication in place, it could be perfectly fine to use the System Context for this purpose. Instead of setting up an entire session, simply use Core.getSystemContext whenever a context is required (firing Microflows and creating/committing objects).

If you'd like to have some kind of authentication or limit what your CORBA service can do, you can also manually instantiate sessions using the com.mendix.core.Core.login method:

public static ISession login(String userName, String password)

Whether you hardcode a user/pass in your service to limit the authorization of the service or add them as parameters to the CORBA service is up to you. Note that only one active session can currently be active for one user, so using the login method can introduce concurrency issues if the session doesn't persist in your CORBA service.