ShowTable of Contents
Modified results from a REST Service Call builder
Application Pattern
Modify the data retrieved using a REST Service Call builder. The XML data retrieved from a back-end server may not be in the format needed by your WEF application. Sometimes the structure of the data needs to be changed; sometimes the values of the data need to be changed. Web Experience Factory provides tools for doing both.
Builders Used
| Builder | Description |
| REST Service Call, with a Restructure Handler | Retrieve data from a REST service and restructure it for use by a WEF application. |
| Transform Map | Map the XML schema of the REST service to the XML schema used by a WEF application. |
| Transform Modify | Modify the XML values returned by the REST service. |
| Method | Provide simple Java code for post-processing REST service result values. |
| Linked Java Object | Provide complex Java code for post-processing REST service result values. |
Best Practices
There are several different builders that can be used to modify the data returned by a REST Service Call builder. The appropriate builder to use depends on the modifications being made.
If the structure of the XML data is being changed, use a Transform Map builder or a "restructure handler". The Transform Map builder provides a visual approach to restructuring the schema, and can be chained together with other transform builders. Using a restructure handler requires the development of a Java class, but can be used in complex situations that may not be suited for transform builders. Both of these approaches will generate the appropriate results schema for use by other WEF builders.
If only the values of the XML data are being changed, use a Transform Modify builder and/or a Method builder. The Transform Modify builder provides a visual approach to modifying result values, and can be chained together with other transform builders. A Method builder can be used separately or in conjunction with a Transform Modify builder to supply Java code for modifying the result values. If the required logic is complex or extensive, a Linked Java Object can also be used to supply the Java code.
Method builders and Linked Java Objects should not typically be used to make post-processing changes to the structure of the results, because Web Experience Factory will not generate a new schema for the modified structure. If it is absolutely necessary to use Java code for post-processing changes to the structure of the results, then the new results structure should be explicitly defined using a Schema builder. The new schema should then be explicitly specified as the Results Schema in the Service Operation builder. The referenced samples do not illustrate this type of functionality.
Samples
Transforming the Results of a REST Service Call
. Use multiple transform builders to modify the structure of the data and the values returned by a REST Service Call builder.
Restructuring the Results of a REST Service Call
. Use a restructure handler (Java implementation of the RestructureFeedData interface) to modify the structure of the data returned by a REST Service Call builder.
Revising the Results of a REST Service Call
. Use a Method builder to modify the values returned by a REST Service Call builder.
Resources
Learning Web Experience Factory