I am trying to create a service that will unlock all the services that are locked prior to doing a code deploy (we get errors in our scripts if there are services locked). I tried to tap into the WmRoot servies (wmroot.wm.server.ns) but was unable to get the data in the unlocking service correctly. The wm.server.ns.adminui:unLockMultipleNodes service unlocks all the nodes using an input of string list. The thing is, I am not sure how to manipulate the data from the other services to put it into a string list.
If you run the services getLockedNodesForAllUsers and getAllLocked Nodes, you will see what I am talking about. The data is in a strange format that I was unable to convert.
Ideally, the service would take all the nodes that are locked, maybe exclude a few, then unlock them.
Any thoughts on this? Just really need a method of converting:
<locked_nodes>
<folder.folder:service1>
<itema>
<itemb>
<folder.folder:service2>
<itema>
<itemb>
to a string list of services. Seems simple logically, but programatically I can not get this to work.
First I call: wm.server.ns:getAllLockedNodes to get the list of locked services. If you run this, you will see that the format of the output is:
<all_locks>
<service1> - this is a document, not a string
<data> - this is a string
<service2> - another document
The last call would be: wm.server.ns.adminui:unLockMultipleNodes
This service takes a string list as input, and unlocks any services that may be locked.
The problem…getting from the first service call to the second. Using document to xml didn’t seem to work since the format is off. Any other suggestions? I included the services I call so maybe you could recreate the problem.
Thanks!!
Correct me if i am wrong. You are trying to unlock all the services before you start your deployment process.If yes, here is the solution.
Step1:call the service wm.server.ns:getLockedNodesForAllUsers which gives you list of nodes which are locked for multiple users.This gives you a ByUser document list.
Step2:Loop over by user list fetched from step 1 and execute the step under the loop.
LoopStep1: convert byUser document to XML Values.(pub.document:documentToXMLValues)
LoopStep2:XML string to XML Node(pub.xml:xmlStringToXMLNode)
LoopStep3: create a temporary list something like LockedServiceList. query the xml node by query as “*/record/record/@name”,QueryType:XQL,onNull=Continue and result type as string.(pub.xml:queryXMLNode).
LoopStep4: branch to check the LockedServiceList is null or not . if not null then append to LockedServiceList
Step3: drop byUser document.
Step4: Loop over LockedServiceList obtained in step2.
LoopStep1:pass each value to the service wm.server.ns:unLockNode.This returns the no of nodes unlocked.
I would suggest unlocking all the services irrespective of the user as the code is getting promoted to higher environments and there is no need for the services to be locked. You can exclude Default and Wm** packages and unlock all of them.
There are services for the same else you can write a java service to do the same.
Hi Mahesh,
Could you let us know how you are unlocking by excluding Default and wm* packages. I hope there is no need to write a java service you can achieve that in wm.
This can be done programmatically by exploring the NS classes and it depends on the use case whether we need a java service or not. I did write a similar java service to accomplish the same.
Hi Mahesh,
Please find the steps above which I have mentioned in the thread. That what I am trying to say there is no need a java service. we can use webMethods build-in service and write a solution.
The solution will unlock all the service who ever is locks the service. I hope that is what asked in the thread. Java services is fine but wm solves the issue. I wrote the solution in wm itself to unlock all and it is working as expected.
I do agree but in the older version, it was lacking the exact service for my use-case. If you have the OOTB of service then there is no need to reinvent the wheel.
additional informations:
There is NO need to unlock the services on the source server, but you should make sure that there are no locked services in the package on the target server.
Deployment of the package will fail when there are locked services in this package on the target.