Friday, 28 February 2020

PeopleSoft - Integration Broker - Error Handling and Exception



  PeopleSoft Allows user to handle exceptions using the Peoplecode.  When there are exceptions   arises during sending messages the following code can be deployed to exactly capture the error associated with exception and write to an error report.

      LogoutRespMSG = %IntBroker.SyncRequest(&LogoutMSG);
     If &LogoutRespMSG.ResponseStatus <> %IB_Status_Success Then
      MessageBox(0, "", 0, 0, "Trouble Calling Logout API.please Check integration logs");
     &nMsgNumber = &LogoutRespMSG.IBException.MessageNumber;
     &nMsgSetNumber = &LogoutRespMSG.IBException.MessageSetNumber;
     &exceptString = &LogoutRespMSG.IBException.ToString();
     &UpdxmldocReturn = &LogoutRespMSG.GetXmlDoc();
     MessageBox(0, "", 0, 0, "&exceptString" | &exceptString);
     &logoutxmldocReturn = &LogoutRespMSG.GetXmlDoc();
    &exceptionCode = &logoutxmldocReturn.DocumentElement.GetElementsByTagName("exceptionCode").Get(1).NodeValue;
   &exceptionMessage = &logoutxmldocReturn.DocumentElement.GetElementsByTagName(":exceptionMessage").Get(1).NodeValue;
   MessageBox(0, "", 0, 0, " Logout API exceptionCode:" | &exceptionCode);
   MessageBox(0, "", 0, 0, "Logout API exceptionMessage:" | &exceptionMessage);

 End-If;

This code works when the user exception check box checked at the Service Operation routing definition page. Without this checkbox checked, peoplesoft will fail the integration and logs a generic message.


PeopleSoft - Integration Broker - Override Connector Properties

      
      PeopleSoft Integration Broker Allows to override the connector Properties. 
      The following code example shows how HTTPTARGET connector properties can be set at run time using peoplecode.
    

       &LogoutMSG = CreateMessage(Operation.LOGOUT22824);

      &LogoutMSG.IBInfo.IBConnectorInfo.ConnectorName = "HTTPTARGET";
      &LogoutMSG.IBInfo.IBConnectorInfo.ConnectorClassName = "HttpTargetConnector";
      &b2 = &LogoutMSG.IBInfo.IBConnectorInfo.AddConnectorProperties("Content-Type", "text/xml", %Header);
      &b2 = &LogoutMSG.IBInfo.IBConnectorInfo.AddConnectorProperties("sendUncompressed", "Y", %Header);
      &b2 = &LogoutMSG.IBInfo.IBConnectorInfo.AddConnectorProperties("Method", "POST", %HttpProperty);
      &b2 = &LogoutMSG.IBInfo.IBConnectorInfo.AddConnectorProperties("SOAPUpContent", "Y", %HttpProperty);
/* &serverUrl,  is the End point URL to which message needs to be posted */
      &b2 = &LogoutMSG.IBInfo.IBConnectorInfo.AddConnectorProperties("URL", &serverUrl, %HttpProperty);
  
      &LogoutMSG.IBInfo.ConnectorOverride = True;

     &LogoutMSG.SetXmlDoc(&logout_xmldoc);
     &LogoutRespMSG = %IntBroker.SyncRequest(&LogoutMSG);

     
Points to be considered:


  1. Dynamic assignment of Connector properties allows to skip Configuration of Connector Properties at the Service Operation Routing.



Connector Properties in Service Operation Routing