Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Adding additional attributes in the web service response

    Posted Wed March 12, 2025 12:53 AM
    Edited by Suhas Joshi Mon March 17, 2025 07:04 AM

    Hi,

    We have a web service based on enterprise service. In the response(Create/Update), we get the values of key attributes (such as wonum, siteid). However, along with these key attributes, we also need to add few more attributes in the response. Is it possible? If someone has done something like this earlier, please share your inputs.

    #IBMMaximo

    #IBMMaximoAssetManagement

    #Maximo

    Thanks,

    Suhas



    ------------------------------
    Suhas Joshi
    ------------------------------



  • 2.  RE: Adding additional attributes in the web service response

    Posted Tue March 18, 2025 04:07 AM

    Hi Suhas,

    as you said, by default Maximo eventually in response returns only values of key attributes (ref. Including responses to every WebService call for more details).

    It is though possible to include more information in the response by injecting customization into processing pipeline. This can be done in several ways - object structure or enterprise service level - depending on your needs. 

    One example way of doing this could be by implementing enterprise service outbound exit processing class or automation script.

     

    The class or script itself can append whatever information you like to the response. Following one, defined for MXGLCOMPInterface, appends to every object in the response COMPTEXT value.

    for(var i = 0; i < irData.getSize(); i++) {
        irData.setCurrentPosition(i);
        irData.setAsCurrent();
        irData.setCurrentData("COMPTEXT", irData.getCurrentMbo().getString("COMPTEXT"))
    }



    ------------------------------
    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V.
    Wrocław, Poland
    ------------------------------



  • 3.  RE: Adding additional attributes in the web service response

    Posted Wed March 19, 2025 06:44 AM
    Edited by Suhas Joshi Wed March 19, 2025 06:48 AM

    Hi Andrezj,

    I tried setting up the system property first which gives me the key fields in the response. It is Sync operation. Now I wrote below script to add description to my response. It is enterprise service --> Response -->User Exit-->After External Exit. I am getting an error.

    Script:

    irData.breakData()
    irData.setCurrentData("DESCRIPTION","hello")

    Error:

    	null
    	at psdi.iface.mic.EntMicService.processDataIn(EntMicService.java:1488)
    	at psdi.iface.mic.EntMicService.processExternalData(EntMicService.java:1335)
    	at psdi.iface.mic.EntMicService.processExternalData(EntMicService.java:1163)

    Caused by: java.lang.NullPointerException at psdi.iface.mic.StructureData.breakData(StructureData.java:634) at psdi.iface.migexits.ExitProcessor.makeStructureData(ExitProcessor.java:381) at psdi.iface.migexits.ExitProcessor.processTheseExitsOut(ExitProcessor.java:350)

    Input JSON to create a WO is:

    {
        "siteid":"ABCD",
        "orgid":"PQRS",
        "description":"test workorder. Please ignore"
    }



    ------------------------------
    Suhas Joshi
    ------------------------------



  • 4.  RE: Adding additional attributes in the web service response

    Posted Wed March 19, 2025 07:39 AM

    Hi Suhash,

    I would be way easier to help you in your specific case if you share exact details of your config. So far I've been assuming that you're using classic (SOAP) web service with XML payload and apparently I was wrong....

    There might be differences in how JSON vs XML is being handled throughout the integration processing pipeline. Therefore in order to avoid any further misunderstanding please describe in an concise way how did you set up your "endpoint" and how do you call it (preferably with curl equivalent included). 



    ------------------------------
    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V.
    Wrocław, Poland
    ------------------------------



  • 5.  RE: Adding additional attributes in the web service response

    Posted Thu March 20, 2025 01:11 AM
    Edited by Suhas Joshi Thu March 20, 2025 01:22 AM

    Hi Andrezj,

    We have some issue currently testing web service so for now we are testing with a http post using below url in postman with the above JSON input to create a workorder. If there is no user exit script, response gives back the key fields (wonum, siteid). However, as soon as I add the script to provide description field in the response, I get the above mentioned error.

    URL - hostname:port/meaweb/es/extsysname/entservname



    ------------------------------
    Suhas Joshi
    ------------------------------



  • 6.  RE: Adding additional attributes in the web service response

    Posted Thu March 20, 2025 02:30 AM

    Hi Andrezj,

    Just an update. I changed the input format to xml and with similar code you have shared, I can see the extra attribute in the response along with key attributes. Thanks for your inputs. It did help.



    ------------------------------
    Suhas Joshi
    ------------------------------