Altova MapForce Server 2025 Advanced Edition

Dynamic Authentication

Home Prev Top Next

In MapForce, it is possible to configure mappings that call Web services for basic HTTP authentication. Dynamic authentication is one of the ways to achieve this; it is an alternative to using credentials. Dynamic authentication means designing the mapping so that it accepts the username and password as input parameters. For details about configuring dynamic authentication, refer to MapForce documentation (https://www.altova.com/documentation).

 

If you configured the mapping for dynamic authentication, then the respective username and password must be supplied as parameters at mapping runtime. This is not different from supplying any other parameter kinds to the mapping. For example, when calling MapForce Server at the command line, the syntax for a mapping like the one above is:

 

<exec> run mapping.mfx --p=username:admin --p=password:dj9JaVax

 

Where:

 

<exec> is the path to the MapForce Server executable. This path can be either absolute or, if the current directory is the same as the executable, you can enter just the executable name.

username and password are the names of the respective input parameters on the MapForce mapping.

 

When calling the MapForce Server API, you can authenticate the mapping by calling the AddParameter method before calling the Run method. For example, in C#, the code to achieve this could look as follows:

 

try
{
  Altova.MapForceServer.Server mfs = new Altova.MapForceServer.Server();
  mfs.AddParameter("username", "admin");
  mfs.AddParameter("password", "dj9JaVax");
  mfs.WorkingDirectory = "C:\\Work";
  if(mfs.Run("C:\\Work\\mapping.mfx"))
  {
    Console.WriteLine("Success");
  }
  else
  {
    Console.WriteLine(mfs.LastExecutionMessage);
  }
  Console.ReadLine();
}
catch(Exception ex)
{
Console.WriteLine(ex);
}

 

Again, the username and password (first argument to the AddParameter method) must be the same as the names of the respective input parameters on the MapForce mapping.

© 2018-2024 Altova GmbH