I will explore useful information I received from Karin – Principal Software Architect at Infor Product Development and technology evangelist at the Smart Office blog – in response to my ask for help with continuous integration of Mashups. Refer to my posts #1 and #2 for the backstory.
Disclaimer
I will be exploring web services and APIs that are internal to Smart Office, and not supposed to be used by anyone other than Infor Product Development. Also, they may change at any time in a future version. So use are your own risk.
No command line 😦
Karin confirmed “unfortunately there is no command-line support in LifeCycle Manager (LCM)”, at least not publicly available. And regarding the Velocity scripts, she said they “are only for applications so via LCM it is not possible to use command line.”
Bummer!
Use MangoServer, not LCM 🙂
She added “In the latest version of 10.2.1. you can consider using REST/Servlet upload to automatically upload Mashups. But that means that you will be managing them from outside of LCM from that time on which kind of leaves the installation you will be working on in a limbo since it will have old entries in LCM that you should never care about again. But it might still be worth the effort to remove all the mashups in LCM and manage them in the Management pages for the Mango Server. [The service] is internal as we use it from the Management pages it is not a real WS/REST service but grid internal.”
Waaaa? We can deploy directly to MangoServer and short-circuit LCM?
Web Services
I think Karin is referring to the /mangows Web Service used by the Mashup File Administration tool as identified with .NET Reflector and Fiddler:
I explored the various WSDL and found that InstallationPointManager has the method DeployMashup:
The method takes two input parameters: Name takes the Mashup’s filename+extension (e.g. Thibaud.mashup), and MashupFile takes the Base64-encoding of the Mashup’s binary contents; I use the bash command $ base64 -w 0 Thibaud.mashup or whatever Base64 encoding tool, and make sure to copy/paste the result as a single line:
The web service adds the Mashup to the MangoServer database:
Finally, we restart Smart Office, and we can now use the Mashup:
FANTASTIC! I can easily write a command line that calls the web service.
Note 1: We can keep calling the web service to deploy new versions of the Mashup, and it will override the old version with the new versions; good.
Note 2: I could not find a web service to un-deploy a Mashup. So if we need to remove a Mashup, I guess we have to change the access to None in the Mashup File Administration tool; to be tested.
Note 3: The web service will always return the same response regardless of if it succeeded or not. I had to turn on the DEBUG and TRACE log levels of the MangoServer application and of other Grid applications to get the details I needed:
Note 4: I think you have to be in the MangoServer/Administrator role:
To LCM, or not to LCM?
As Karin said, from now on that Mashup cannot be administered in LCM, it doesn’t even show in LCM:
We can still continue to use LCM to administer legacy Mashups and to upload new Mashups, as long as they don’t have the same name as the Mashups we deploy via the MangoServer web service. That’s mixed administration.
Now we have the choice of how to administer Mashups: either we administer them all in LCM as before, either we administer them all in MangoServer with the web service, in which case it’s probably best to un-register the legacy Mashups from LCM to avoid confusion, either we administer them mixedly, in which case it will probably be confusing.
UPDATE 2016-06-06: Karin said it is very important to remove Mashups from LCM and only manage them via Smart Office if that is what we decide to do.
MangoAdmin
Karin adds: “[You can] use the MangoAdmin tool to import mashups files. But since they require a metadata file with table entries it’s a bit too much work to do them manually. But it is an alternative if you create one zip and then import against different environments. But it needs to be in the UI to be able to upload the file. There is a command line version but it requires the zip to already be uploaded to the server in the MangoData/Import folder. With the Mango Admin tool I mean the stand alone tool (exe) that is found in the download zip. It has one UI version and one command line exe version.”
I could not find said MangoAdmin tool. I found some tools in the Smart Office SDK but they do not take Mashups as input nor output:
UPDATE 2016-06-06: The Mango Admin Tool is explained at, https://smartofficeblog.com/2014/11/20/mango-admin-tool-the-import-and-export-tool/
Instead, I decompiled the Mashup Designer again, and replicated how it generates the Mashup file:
It calls the method Mashup.Designer.DeploymentHelper.SaveMashupFile which calls the private method ValidateManifest and the public method CreatePackageFromManifest:
Here is the source code to do the same:
import System.IO; import System.Reflection; import Mango.UI.Services.Mashup; import Mango.UI.Services.Mashup.Internal; import Mashup.Designer; package MForms.JScript { class Test { public function Init(element: Object, args: Object, controller : Object, debug : Object) { var manifest: ManifestDesigner = new ManifestDesigner(new FileInfo("C:\\Mashups\\ThibaudMashup.manifest")); DeploymentHelper.InvokeMember("ValidateManifest", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, null, null, [manifest]); var defaultFileName: String = manifest.File.Directory + "\\" + manifest.DeploymentName + Defines.ExtensionMashup; var packageFile: FileInfo = new FileInfo(defaultFileName); Mango.UI.Services.Mashup.Internal.PackageHelper.CreatePackageFromManifest(manifest, manifest.File, packageFile, PackageHelper.DeployTarget_LSO); var message: String = "Please note that this Mashup contains a profile section and should be deployed using Life Cycle Manager. Warning - Using the Mashup File Administration tool will not result in a merge of profile information into the profile."; if (manifest.GetProfileNode() != null) { debug.WriteLine(message); } } } }
FeatureServlet
Karin said of the latest Smart Office: “I looked around to see what we had to upload a .lawsonapp and we just added it to the HF that will be released now. Anyway we have added a upload servlet that needs to get a single file using: “A file upload request comprises an ordered list of items that are encoded according to RFC 1867, “Form-based File Upload in HTML”. FileUpload can parse such a request and provide your application with a list of the individual uploaded items.” You post a file to /FeatureServlet and then it will be uploaded. You need to be a Smart Office administrator to do this. This servlet is completely new so if you browse to /mango/FeatureServlet and get HTTP 404 you don’t have it. No documentation available.”
My server does not have that hotfix so that’s future work.
Future work
Next time I will:
- Call the MangoServer web service from a command line
- Transform the script into a command line
- Explore the Mango Admin tool
- Explore the FeatureServlet of the latest Smart Office hotfix
Conclusion
I now have a solution to deploy Mashups via a web service. It short-circuits LifeCycle Manager and deploys directly to the MangoServer, so we have to decide how to administer Mashups from that point forward. Also, I have a solution to generate the Mashup files from the manifest, with validation and metadata. That’s all I need for my goal of a command line. Next time I will do the command line.
That’s it!
Please leave a comment below, slap a Like, follow this blog, share with your colleagues, and come write something.
Thank you Karin!!
Related posts
- Continuous integration of Mashups #1 – HELP WANTED!!
- Continuous integration of Mashups #2 – Reverse engineering
- Continuous integration of Mashups #3 – HELP GOTTEN!!
- Continuous integration of Mashups #4 – Command line
Note: To un-deploy a Mashup, maybe we can use Mango.Core.ApplicationInstallerService.Uninstall(string name); to be tested
LikeLike
UPDATE: I moved the disclaimer to the top, and I added Karin’s update about the importance of removing Mashups from LCM if we decide to administer them in Smart Office.
LikeLike
UPDATE: I added the link to the Mango Admin Tool; for future work
LikeLike