2

In Visual Studio, I can right click a map (.btm file) and select "Validate Map" manually for one map. Then I can click and see the XSLT.

Is there a way to call this function? I would like to turn about 150 maps into XSLT for analysis and comparing how similar/different they are.

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
NealWalters
  • 17,197
  • 42
  • 141
  • 251
  • It should be possible, because in the compiled DLLs they are in the XSLT version rather than the .btm, so you should be able to use reflection to extract the xslt string. I've done that manually on occasions when source code was lost as per https://stackoverflow.com/questions/20877720/biztalk-orchestration-reverse-engineer/20878826#20878826 – Dijkgraaf Jul 05 '18 at 23:54

1 Answers1

1

You can dynamically load and call maps from an orchestration like so:

// dynamicMapType is declared 'System.Type'
dynamicMapType = Helper.GetMapType(MessageTypeName);
// Call the transform given by the object type, pass in a message
transform(msgOut) = dynamicMapType(msgIn);

Here's an example to get a map object type. I put mine in a C# helper assembly.

public static System.Type GetMapType(string MessageType)
{
    System.Type typ = null;
    switch (MessageType.ToUpper())
    {
        case "ONE":
            typ = System.Type.GetType("AssemblyQualifiedName_from_gacutil");
            break;
        default:
            throw new SystemException("Could not determine map transform type '" + MessageType + "'");
    }
    if (typ == null)
        throw new SystemException("Could not load map transform type '" + MessageType + "'");
    return typ;
}
Jay
  • 13,803
  • 4
  • 42
  • 69
  • Thanks, I'm working on other things now; when i come back to this will try and mark as answer. – NealWalters Jul 17 '18 at 18:21
  • Hi, was looking at this again. Where does your answer talk about getting the XSLT of the map? I'm trying to do this from C# or Powershell, not an Orchestration. But I would be interested in running the map from C# as well. – NealWalters Dec 07 '18 at 22:39
  • Sorry, I misread your question. I saw "how to programmatically call the map" – Jay Dec 08 '18 at 04:19