While the JSON API in newer version of Maximo is quite useful, for many integration scenarios, I still prefer to use the old API infrastructure with Publish Channel and Web Service. However, the native format for this feature is XML.
To send or receive JSON with Publish Channel or Enterprise Service, we can translate the default to JSON format before it goes out / into the system. Below is a simple example to set it up.
Setup standard Publish Channel to send XML message
- Create a new Publish Channel:
- Name: ZZSR
- Object Structure: MXSR
- Create a new Enterprise Service:
- Name: ZZSR
- Object Structure: MXSR
- Create a new HTTP End Point: ZZWEBHOOK (To keep it simple, we use webhook.site. See more details here)
- Create a new External System:
- Name: ZZTEST
- End Point: ZZWEBHOOK
- Set standard queues.
- In Publish Channels tab, add the ZZSR channel created above.
- Enable the channel, enable the external system, and enable event listener on the channel
- To test and verify our Publish channel is working:
- Create a new Service Request, then save.
- After less than a minute, Webhook should show a new message received in XML format
To send JSON instead of XML:
- Update publish channel ZZSR, set Processing Class with value com.ibm.tivoli.maximo.fdmbo.JSONMapperExit
- Go to the JSON Mapping application, create a new mapping:
- Name: ZZTEST.ZZSR.OUT (it must follow this exact format <ExtSys>.<PublishChannel>.OUT)
- Object Structure: MXSR
- JSON Data: { "summary": "Test SR", "details": "Sample Details", "assetnum": "11430" }
- Save the record. Then go to Properties tab. Enter mapping as follows
- To test the mapping works, create another SR. And check in Webhook to ensure it now receive a new message in JSON format
To receive JSON on Webservice, use similar step like above, the only key difference is, we have to name the JSON mapping as <ExtSys>.<EntService>.IN. And use a mapping like the example below
No comments:
Post a Comment