Magic Software
Lesson 3Hands-on · ~30 min

Magic xpi Project

Time to roll up your sleeves. In this lesson you'll start the Magic xpi services, create a new project in the Studio, and tour the environment variables and project properties that every Magic xpi project ships with.

Starting the Magic xpi IMM Agent service

In Magic xpi 4.14.1 the runtime service is the Magic xpi 4.14 IMM Agent (formerly the GSA service in older versions). A Magic xpi project can't run if the service isn't running, so let's confirm it's healthy.

  1. Press Win+R, type services.msc, and press Enter.
  2. In the Services window, locate Magic xpi 4.14 IMM Agent.
  3. Confirm its Status is Running and its Startup Type is Automatic.
  4. If it isn't running, double-click it, set Startup type to Automatic, then click Start.
Windows Services panel with Magic xpi 4.14 IMM Agent highlighted, status Running
Windows Services panel with the Magic xpi runtime services. The IMM Agent, Soap Service, and Debug Server should all be Running.
Tip. Magic xpi 4.14 ships several runtime services — IMM Agent, Soap Service, and Debug Server are the most important. Leaving them on Automatic startup means they're available the moment you launch the Studio.

Creating a project

Launch the Magic xpi Studio from the Windows Start menu (or its desktop shortcut). To create a new project:

  1. Click the File menu and choose New » Project — or press Ctrl+Shift+N.
  2. In the New Project dialog, select Magic xpi Project under Installed Templates.
  3. Fill in the Name, Location, and Solution name fields. For this course use the name Magic_xpi_course.
  4. Leave Create directory for solution selected.
  5. Click OK.
New Project dialog with Magic xpi templates listed and project metadata fields
The New Project dialog in Magic xpi 4.14.1.
NameIdentifies your integration project; used as an index in various tables.
LocationThe folder where your project will be created.
Solution nameDefaults to the project name. Useful when several related projects share a solution.
Create directory for solutionKeeps the solution files in their own folder — recommended.

Created project files

Magic xpi creates several files and folders on disk. Some you'll touch often:

Source/XML source files that describe the project. Don't edit these by hand.
Magic_xpi_course.mgxpiprojThe project metadata.
Resources.xmlSettings for the external resources the project uses.
Services.xmlSettings for the services the project exposes externally.
Course data. Drop the supplied course_data folder into the project directory before continuing — you'll use it from Lesson 4 onward.

Environment variables

Environment variables are configuration variables for the project. They make projects portable between environments (Development → Test → Production) by letting you reference paths and connection details symbolically.

Magic xpi resolves these variables at runtime using the values in the Settings dialog under General Environment » Internal Environment Variables. New projects come with a number of predefined environment variables already populated for you:

currentprojectdirThe path to the current project's folder. Use this to avoid hard-coded directory paths.
currentprojectThe full path of the loaded project file (.mgxpiproj). Updated automatically when the project loads.
magicxpi, magicxpaInstall locations for the runtime engine and Magic xpa.
projectsThe root folder under which your projects live.
Settings dialog showing the predefined Internal Environment Variables for a Magic xpi 4.14.1 project
The full set of internal environment variables shipped with a Magic xpi 4.14.1 project.
Reading variables. Wherever you see a name surrounded by percent signs (for example %currentprojectdir%), the runtime substitutes the variable's value. You'll see this pattern throughout the Settings dialog.

Project properties

A Magic xpi project has properties that you can configure to your requirements in the Project Properties window. Open it from the Project menu » <Project Name> Properties.

Project Properties pane showing description, version, encoding, and email environment fields
Project Properties pane in Magic xpi 4.14.1.
NameProject name (read-only here).
DescriptionFree-text description of the project.
Modified / OwnerRead-only audit fields.
VersionMaintained by the developer for documentation.
Project Data EncodingCharacter set for the project files and any XML the Data Mapper produces.
Resource / Services / Calendars Settings FilePointers to the XML files that hold those settings — edit them externally to port the project between environments.
Send Error Email To / Email ResourceOptional environment-level email destination for project errors.
ODS InformationWhether ODS information is cleared on project reload.

Course project

Throughout this course you'll build an order-handling integration for a fictional company. The challenge will keep growing as the lessons progress.

Company description

MSU Computers Ltd. sells computer hardware. There are three departments: Purchasing manages stock; Sales handles customer relations and order approvals; Distribution delivers approved orders to customers.

The current status

The company runs several disconnected systems and a great deal of manual work. Sales receives requests in XML, approves them at two levels, and Logistics confirms stock by phone or email. Approved requests are re-entered by hand into Distribution's system — a lot of opportunities for error.

The challenge

Management wants to:

  • Let customers register and submit requests via the web.
  • Reduce the cost of order handling and post-sale processing.

The proposed solution

  • Connect all of the company's systems.
  • Receive requests through the website and surface them on the company's system — eliminating duplicate data entry.
  • Cut request-handling time and human error.
  • Define an Exception Approval process for orders with insufficient stock.
  • Add automatic email notifications and approval requests.

Project description

The course project handles each customer request like this:

  1. Accept (or check for) new customer requests.
  2. Check stock availability against the local database.
  3. Allow a human-intervention step where required.
  4. Process the request and update the delivery process.

Summary

You should now be able to:

  • Verify that the Magic xpi 4.14 runtime services are running.
  • Create a new Magic xpi project in the Studio.
  • Find your way around environment variables and project properties.
  • Describe the business challenge you'll be solving for the rest of the course.