Service input and output parameters are defined within the Service's definition using XML declaration statements with an element tag of attribute
. Each XML attribute
element declaration represents either an input parameter (INPUT
), an output parameter (OUTPUT
), or a parameter that is passed as both input and output (INOUT
). The participation of each parameter as an input or output value may be made optional by adding an optional
attribute to the declaration. By default, the optional
value is false
, and all parameters that are defined are required to be passed. This means that the Service will fail if one or more of the configured (non-optional) parameters are not passed.
Note: If an INPUT
parameter is not defined for a Service, then that value will not be passed into the Service's execution context regardless of the values that are sent by the calling program. Similarly, if an OUT
or INOUT
parameter is not defined for a value, then that value will not be passed back to the calling program.
Add one or more attribute
elements within the Service definition. For example:
<service name="myService" engine="SupportedEngine" location="somewhere.on.the.classpath" invoke="myService"> <attribute name="attribute1" type="String" mode="IN" optional="true"/> <attribute name="attribute2" type="String" mode="IN" optional="false"/> <attribute name="attribute3" type="String" mode="INOUT"/> </service>
The OFBiz Service Engine handles the passing of input, output, and context parameters automatically based on the Service's Service definition. Only parameters configured for the Service (and several OFBiz managed context parameters such as the userLogin GenericValue, locale, timeZone, errorMessage
, and errorMessageList)
will be passed as input or as output.
By default, OFBiz automatically validates, at runtime, all incoming and outgoing parameters against the defined type
attribute as configured. Validation failures will cause the Service to fail and control will be passed back to the calling program.
18.191.195.111