The Factory Class 
Assume that you want to append an attachment to your message. The Proxy Framework must take this into account when constructing the message. However, if you want to identify the receiver of a message in advance, you can only find this information if you execute logical routing for the maintained data. You must direct any queries to the respective components shortly before the message is sent.
Proxy Framework provides you with the factory class CL_AI_FACTORY, which you can use to generate objects that enable you to use the special services of the Proxy Framework.

You do not need a factory class to process default and initial values.
To be able to use the factory class, you must first load its class definition:
class cl_ai_factory definition load.
Using the factory class, you can generate the following objects:
|
Object |
Use |
|
Controller
Object
|
Using this object, you can do the following: Set the receiver; Call the payload (after a message is sent or received); Append attachments to the message or remove them when the message is received ; guarantee the sequence of asynchronous messages. You can transfer the controller object to your outbound proxy using the parameter CONTROLLER, or access it in the inbound proxy, using the same parameter.
This parameter is not visible on the tab page Structure; call transaction SPROXY to access the parameter. To see the exact signature of the outbound method and the parameter CONTROLLER, navigate in the Class Builder ( SE24). |
|
Routing API |
You require this API to identify the logical receiver in advance during logical routing. |
|
Attachment
Object |
An attachment object that you can append to the message using a controller object. |
|
'Preliminary Payload' |
Return of a payload after a simulated proxy call so that you can access the payload before a message is sent. See: Calling the Payload. |
data: l_controler type ref to if_ai_posting_controller.
l_controller = cl_ai_factory=>create_controller( ).
data: l_routing_runtime type ref to IF_ROUTING_LOCAL_RUNTIME.
l_routing_runtime = cl_ai_factory=>create_routing_runtime( ).
To generate an attachment object, use the method create_attachment_from_binary() of the factory class. (See: Appending Attachments at the Sender.
To create the payload of a message, use the method create_parameter2xml()of the factory class. (See: Creating a Payload.