Friday, 26 September 2014

IBM BPM 8.5.0 - Updating REST Endpoints programmatically

Now I've been seeking a way to achieve this for a wee while now, and finally here it is, thanks in large part to the excellent IBM BPM Community within IBM, many of whom came to my rescue.

In essence, I want to be able to update the various REST endpoints within the IBM BPM WAS applications, when I add in IBM HTTP Server ( either co-located or separate ) and HTTP load balancing. This allows the RESTful services to be rendered via the web tier, rather than going directly to the WAS Web Container.

This IS possible via the Integrated Solutions Console (ISC) GUI, but I was struggling to find a CLI way to achieve it.

Thanks to my extended network, this is what worked for me: -

Start wsadmin client

/opt/ibm/WebSphereProfiles/Dmgr01/bin/wsadmin.sh -lang jython -host `hostname` -port 8879  -user wasadmin -password passw0rd

Update Rest Services Gateway - One WAR - rest.gateway.war

AdminTask.updateRESTServiceProvider(['-clusterName','AppCluster','-appName', 'REST Services Gateway_AppCluster', '-webModuleName', 'rest.gateway.war', '-hostName', 'bpm8501.uk.ibm.com', '-port', '8443' , '-transportType', 'https://'])

Update TeamWorks - one RESTy WARs - bpmrest.war

AdminTask.updateRESTServiceProvider(['-clusterName','AppCluster','-appName', 'IBM_BPM_Teamworks_AppCluster', '-webModuleName', 'bpmrest.war', '-hostName', 'bpm8501.uk.ibm.com', '-port', '8443' , '-transportType', 'https://'])

Update BPE Container - one RESTy WAR - bfmrestapi.war

AdminTask.updateRESTServiceProvider(['-clusterName','AppCluster','-appName', 'BPEContainer_AppCluster', '-webModuleName', 'bfmrestapi.war', '-hostName', 'bpm8501.uk.ibm.com', '-port', '8443' , '-transportType', 'https://'])

Update Task Container - one RESTy WAR - taskrestapi.war

AdminTask.updateRESTServiceProvider(['-clusterName','AppCluster','-appName', 'TaskContainer_AppCluster', '-webModuleName', 'taskrestapi.war', '-hostName', 'bpm8501.uk.ibm.com', '-port', '8443' , '-transportType', 'https://'])

Save and Synchronise

AdminConfig.save()
AdminNodeManagement.syncActiveNodes()
quit

I validated that I had the correct number of RESTy WARs: -

cat /opt/ibm/WebSphereProfiles/Dmgr01/config/cells/PSCell1/config-rest.xml | grep 8443

<webModules xmi:id="WBIRestWebModule_1411489980815" name="rest.gateway.war" applicationName="REST Services Gateway_AppCluster" contextRoot="/rest" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<webModules xmi:id="WBIRestWebModule_1411489982410" name="bpmrest.war" applicationName="IBM_BPM_Teamworks_AppCluster" contextRoot="/rest/bpm/wle" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<webModules xmi:id="WBIRestWebModule_1411489983613" name="bfmrestapi.war" applicationName="BPEContainer_AppCluster" contextRoot="/rest/bpm/bfm" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<webModules xmi:id="WBIRestWebModule_1411489983637" name="taskrestapi.war" applicationName="TaskContainer_AppCluster" contextRoot="/rest/bpm/htm" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

cat /opt/ibm/WebSphereProfiles/Dmgr01/config/cells/PSCell1/config-rest.xml | grep ".war"

<webModules xmi:id="WBIRestWebModule_1411489449181" name="rest.gateway.war" applicationName="REST Services Gateway Dmgr" contextRoot="/rest_dmgr" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="9043">

<webModules xmi:id="WBIRestWebModule_1411489980815" name="rest.gateway.war" applicationName="REST Services Gateway_AppCluster" contextRoot="/rest" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<endpoints xmi:id="WBIRestEndpoint_1411489980822" id="6260563d-e009-499d-9d00-1c56cbd062e2" name="Store and forward" description="WBI Store and Forward REST API" type="{com.ibm.bpm}Qualifier" typeDisplayName="SCA Qualifier" version="7.0.0.0" publicEndpoint="true" providerEndpointID="StoreAndForward" relativeURL="/bpm/qos/storeandforward"/>

<webModules xmi:id="WBIRestWebModule_1411489982410" name="bpmrest.war" applicationName="IBM_BPM_Teamworks_AppCluster" contextRoot="/rest/bpm/wle" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<webModules xmi:id="WBIRestWebModule_1411489983613" name="bfmrestapi.war" applicationName="BPEContainer_AppCluster" contextRoot="/rest/bpm/bfm" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

<webModules xmi:id="WBIRestWebModule_1411489983637" name="taskrestapi.war" applicationName="TaskContainer_AppCluster" contextRoot="/rest/bpm/htm" transportType="https://"; hostName="bpm8501.uk.ibm.com" port="8443">

PS This also works for IBM Business Monitor 8.0.1.2, running on WAS 8.0.0.8: -

/opt/ibm/WebSphereProfiles/Dmgr01/bin/wsadmin.sh -lang jython -user wasadmin -password passw0rd
AdminTask.updateRESTServiceProvider(['-clusterName','WebCluster','-appName', 'REST Services Gateway_WebCluster', '-webModuleName', 'rest.gateway.war', '-hostName', 'bam8012.uk.ibm.com., '-port', '8443' , '-transportType', 'https://'])
AdminConfig.save()
AdminNodeManagement.syncActiveNodes()
quit 


*UPDATE* As if by magic, I've just found a page in the IBM BPM documentation that says much the same: -

Updating context roots in an existing network deployment environment

as well as this old-but-good Technote: -

Customize System REST Services Context Root: /rest

No comments: