Invoking Asynchronous Request/Response Oracle Mediator-Based Services
This section discusses invoking asynchronous request/response Oracle Mediator-based services.
Prerequisites for Invoking Asynchronous Request/Response Oracle Mediator-Based Services
Before you can invoke an asynchronous Oracle Mediator/ESB-based service, you must first consume it. Consuming Oracle Mediator/ESB-based services is described elsewhere in this section.
Invoking an Asynchronous Request/Response Oracle Mediator-Based Service
To invoke an asynchronous request/response Oracle Mediator-based service, you must use an OnResponse handler. The following code shows a sample OnResponse handler:
import PS_PT:Integration:INotificationHandler;
import PT_ESB:ESBUtil;
class Esb_AsyncRR implements PS_PT:Integration:INotificationHandler
method Esb_AsyncRR();
method OnResponse(&MSG As Message);
end-class;
/* constructor */
method Esb_AsyncRR
end-method;
method OnResponse
/+ &MSG as Message +/
Local Message &request, &response;
Local File &MYFILE;
Local XmlDoc &xml, &inxml;
Local string &payload, &oper, &input1, &input2, &result_st;
Local integer &result_no;
Local array of XmlNode &nodes;
Local XmlNode &node;
Local PT_ESB:ESBUtil &obj = create PT_ESB:ESBUtil();
&nodes = CreateArray(&node);
&request = &MSG;
&inxml = &request.GetXmlDoc();
&nodes = &inxml.GetElementsByTagName("input1");
&input1 = &nodes [1].NodeValue;
&nodes = &inxml.GetElementsByTagName("input2");
&input2 = &nodes [1].NodeValue;
&result_no = Integer(&input1) * Integer(&input2);
&result_st = String(&result_no);
&payload = "<?xml version='1.0'?><PSFTCalcResponseMessage xmlns='
http://xmlns.oracle.com/Enterprise/Tools/schemas/PSFTCALCRESPONSEMESSAGE.V1'>
<result>" | &result_st | "</result></PSFTCalcResponseMessage>";
&xml = CreateXmlDoc(&payload);
&response = CreateMessage(Operation.ESBASYNCRR, %IntBroker_Response);
&response.SetXmlDoc(&xml);
&response.IBInfo.WSA_MessageID = &request.IBInfo.WSA_MessageID;
&response.IBInfo.WSA_ReplyTo = &request.IBInfo.WSA_ReplyTo;
&obj.UpdateConnectorResponseProperties(&response);
%IntBroker.Publish(&response);
end-method;