ERP message component¶
Communication uses specific messages classes that derive from
The abstract base class defines following properties:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
These properties are publicly accessible by the respective getter and setter methods. Since the properties could be changed anywhere, it is necessary to validate the value of the getter methods before further accessing (e.g. access to supposed members of a response object).
Derived and non-abstract message classes can provide methods for data feeding into the requests and response members or retrieving specific data from them (e.g. address records in customer data messages). But the classes may also just be empty stubs and leave data handling to other parts of the application.
The response status is set by the transport service according to the result of the ERP communication. Following statuses are defined:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
The implementation of the transport service is responsible for the evaluation of the result of the communication and must set the response status accordingly.
Message documents, as been seen in above, should be plain PHP objects.
These classes are intended to store the actual structured data which is mentioned above.
Currently all document classes are created mechanically by XSD2PHP.
This tool creates PHP classes out of XML Schema Definitions,
which may provide the opportunity to validate created data against that definitions.
The created classes only define public member attributes, so you can access data with:
$object->memberVar->subMember->value = 'value';
Instantiation of message classes¶
See ERP message instantiation for more details.
Creating a new listener¶
Create a new class and add a method, that accepts an
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Register the new listener to the inquire message event:
1 2 3 4 5
Event listeners are defined as tagged services. The
name and the
event parameter of the tag must be
method parameter must be the name of the method of the specified class which should be called if the event is dispatched.
This method must define a parameter of type
InquireMessageEvent in order to retrieve the event object.