Friday, July 30, 2010

Handling Integration Broker Error

When integrating with third party applications you may get http 500 error which means that the request failed. It can fail for various reasons and you don't have access to the integrating systems all the time. It is a good practice to handle such errors so that users can see a simple message instead of a cryptic PeopleSoft message. Try Catch block does not handle this error very well and causes the application to error out. You can use system variable %IB_Status_Success to check if the request was successful. Here is a sample code : 


&Response_Msg = %IntBroker.SyncRequest(&Request_Msg);
If &Response_Msg.ResponseStatus = %IB_Status_Success Then
       /* Request was succesful , do response processing */
else
       /* Syncing failed,  do error handling */
      &Msg_Set = &Response_Msg.IBException.MessageSetNumber;
      &Msg_Number = &Response_Msg.IBException.MessageNumber;
      &Msg_Descr = &Response_Msg.IBException.ToString();
      &Fault_Data = &Response_Msg.GetContentString();
       /* You can write response in a file or look for logs on the gateway.  */
      &Response_File =  GetFile(&PS_HOME | " *.xml", "W", %FilePath_Absolute);
      &XML =CreateXmlDoc(&Fault_Data);
      &Response_File.WriteString(&XML.GenFormattedXmlString());
      /* You can display a message to the user here */
end-if;

P.S: Deafult path for Integration Broker error log  is
\\PS_HOME\webserv\peoplesoft\applications\peoplesoft\PSIGW\errorlog.html

No comments:

Post a Comment