Search code examples
webmethods

Package creation in WebMethods


Anybody knows if it's possible to create a new package using a flow service in webMethods developer 7.1. What I want to do is to create a flow service that takes as input a string (package name) and as result it's going to create the new package with the string as name. Does exist anything in developer that I can call from my service and it creates the packages automatically instead of File -> New -> Package?

Thanks!


Solution

  • There is no public/documented way of creating a new package programatically as far as I know. However, if you don't mind using private/undocumented services, and understand that doing so would not be endorsed by SoftwareAG, then you can do the following:

    • If you can't see the WmRoot package in Developer/Designer (this is by design, since it's considered private) you can add the following configuration key to the file ./IntegrationServer/config/server.cnf:

      watt.server.ns.hideWmRoot=false

    • Use the service WmRoot/wm.server.packages:packageCreate to create a new unactivated package. Unfortunately the inputs and outputs to this (and most other WmRoot services) have not been declared, but you just need to add a String variable called package set to the desired package name to the input pipeline to call it.

    • Use the service WmPublic/pub.packages:activatePackage to activate the new package.

    For bonus points, you can programatically create new services in your package as well using the service WmRoot/wm.server.services:serviceAdd (this is one of the few services in WmRoot that mercifully does declare its inputs and outputs).


    Alternatively, if you do not wish to use private/undocumented services, you could create your own service to create a new package relatively easily. Since a brand new package is just a collection of empty directories and a manifest.v3 file, you can write your own service to create these directories and files and then call WmPublic/pub.packages:activatePackage to activate it:

    • IntegrationServer/
      • packages/
        • <package_name>/ - create this directory with the desired package name (MANDATORY)
          • code/ - create this directory (OPTIONAL)
            • classes/ - create this directory (OPTIONAL)
            • jars/ - create this directory (OPTIONAL)
            • source/ - create this directory (OPTIONAL)
          • doc/ - create this directory (OPTIONAL)
          • lib/ - create this directory (OPTIONAL)
          • ns/ - create this directory (OPTIONAL)
          • pub/ - create this directory (OPTIONAL)
            • index.html - create this HTML file as a placeholder home page for the package (OPTIONAL)
          • resources/ - create this directory (OPTIONAL)
          • templates/ - create this directory (OPTIONAL)
          • web/ - create this directory (OPTIONAL)
          • manifest.v3 - create this XML file by copying the structure from another existing package (MANDATORY)

    As you can see, the only things that are actually required to create a new package is a new directory under the ./IntegrationServer/packages/ parent directory, and a manifest.v3 file.

    An example manifest.v3 file from a freshly created package in webMethods Integration Server 7.1.3 is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <Values version="2.0">
      <value name="enabled">yes</value>
      <value name="system_package">no</value>
      <value name="version">1.0</value>
      <null name="startup_services"/>
      <null name="shutdown_services"/>
      <null name="replication_services"/>
      <null name="requires"/>
      <null name="listACL"/>
    </Values>
    

    A final note: if you take this alternative approach of building your own package creation service, just be careful not to create a new package whose name is considered illegal by webMethods Integration Server.