Service Callouts - Forum - Corticon - Progress Community

Service Callouts


Service Callouts

  • Hi,

    I created a service callout extension to call a decision service from another decision service using below code.

    XMLResult =  iServer.execute(XMLRequest);

    The result is in XML format like


    <parent tags>


    <child tags>



    Please suggest if there is a way to directly copy the result(XMLResult) in new instance of Corticon facts pool.

    For example, I created instances of Corticon entities (as shown below), is there a way to parse the xml string(XMLResult) and assign the value to the attributes of these objects (objParent, objChild).

    ICcDataObject objParent = aDataObjMgr.createEntity("Parent");

    ICcDataObject objChild = aDataObjMgr.createEntity("Child");




  • Sounds like you are trying to create an association between the parent and its children in addition to setting attribute values
    Here’s an example of how you can establish the associations:
                  // Create a customDataType called colorType and add it to the vocabulary
                  ICcDataObject colorType = aDataObjMgr.createEntity("CustomDataType");// Create a CustomDateType entity
                  colorType.setAttributeValue("name", "colorType");                    // Set its name to colorType
                  colorType.setAttributeValue("baseType", "String");                   // Set its base type to String
                  colorType.setAttributeValue("enumeration", "Yes");                   // Set its enumeration to Yes
                  colorType.setAttributeValue("constraint", "");                       // Set its constraint to empty
                  vocab.addAssociation("customDataTypes", colorType);                 // Associate ColorType with the vocabulary V1 (role name is customDataTypes)
                  ICcDataObject llabelValue = aDataObjMgr.createEntity("LabelValuePair");// Create a LabelValuePair entity
                  llabelValue.setAttributeValue("label", "Red");                         // Set its label to Red
                  llabelValue.setAttributeValue("value", "Red");                         // Set its value to Red
                  colorType.addAssociation("labelValuePairs", llabelValue);              // Associate it with the data type ColorType (role name is labelValuePairs)
    As far as actually parsing the XML payload to locate the various attributes and their values – I’m afraid I don’t know any simple way to do that.
    You also have to deal with matching up the returned values with the corresponding rule message.
    One way to make this easier is to bypass the built in Corticon rule statements and create your own rule statements (by defining your own entity called Message and created using the Corticon new operator) that are directly associated with the business objects – then they will automatically be matched up. If you do this then you can easily add any extra meta-data you need – something you cannot do with the built in rule statement/message mechanism.
    In javascript you can do something like this (this is an example from a Rollbase javascript trigger) – but I’m not sure if that helps with java parsing of XML.
    Maybe some of the other SEs have some ideas on this.
    var xmlRequest=
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
    "<SOAP-ENV:Envelope" +
    "  xmlns:SOAP-ENV=\"\" " +
    "  xmlns:SOAP-ENC=\"\" " +
    "  <SOAP-ENV:Body>" +
    "    <CorticonRequest " +
    "     xmlns=\"urn:Corticon\" " +
    "     xmlns:xsi=\"\" " +
    "      decisionServiceName=\"RollbaseRetirementEligibility\">" +
    "      <WorkDocuments>" +
    "        <Person id=\"Person_id_1\">" +
    "          <age>{!age}</age>" +
    "          <name>{!name}</name>" +
    "          <membershipMaintained>{!membership#value}</membershipMaintained>" +
    "        </Person>" +
    "      </WorkDocuments>" +
    "    </CorticonRequest>" +
    "  </SOAP-ENV:Body>" +
    var response=rbv_api.sendJSONRequest(url,xmlRequest,"POST","text/xml;charset:UTF8",null,null,params);
    var root = rbv_api.parseXML(response);
    var status = root.getElementsByTagName('ns1:normalAgeStatus').item(0).getFirstChild().getNodeValue();
    rbv_api.setFieldValue('retiree', {!id}, 'status',status);
    var message = root.getElementsByTagName('ns1:text').item(0).getFirstChild().getNodeValue();
    rbv_api.setFieldValue('retiree', {!id}, 'reason',message);
  • Are the decision services based on the same vocabulary? If so it would be much easier to simply place the Ruleflow of the second decision in the Ruleflow of the first decision.
    Christopher S. Hogan
    Principal Systems Engineer