Use Java™ or PHP code to modify pattern instances when the pattern user generates an instance of a user-defined pattern. For example, you can use Java or PHP code to modify the structure of a message flow based on the values of pattern parameters.
When you author user-defined patterns, you can include Java or PHP code to modify pattern instances. This code is run when the pattern user generates an instance of a user-defined pattern and can be used to carry out a number of actions on the pattern.
By using the IBM® Integration API, you can access all the nodes, connections, and pattern parameters in a user-defined pattern. Examples of changes that you can make by using Java code are:
By using the PHP API for user-defined patterns, you can access the pattern parameters and the pattern instance name of a user-defined pattern. Examples of changes that you can make by using PHP code are:
Do not use Java or PHP API code to set the WSDL file name property, or any of the properties set by the WSDL file, on a SOAPInput, SOAPRequest, or SOAPAsyncRequest node in your user-defined pattern. To set the WSDL file name property, see Configuring SOAP nodes for user-defined patterns. To modify other properties on these nodes, select the properties as target properties when you create your user-defined pattern. To select target properties, see Defining the target properties.
IBM Integration Bus contains a Java to PHP bridge, therefore you can complete some pattern authoring tasks by using either Java or PHP. You can choose which language to use based on the existing skills, assets, or libraries within your organization. The IBM Integration Toolkit includes code completion and a debugger for Java, which make Java a good choice for longer or more complex code. PHP written in the IBM Integration Toolkit can be changed and tested without relaunching the workbench, which makes PHP a good choice if you want to change your code and view the results quickly. If you do not have a preference between Java and PHP after considering the skills and assets of your organization and the testing approach, use Java for changes to the structure of the message flow and use PHP to modify text files.
The code you write to modify pattern instances is contained in a separate plug-in from the user-defined pattern. When you create a pattern archive, your code plug-ins are automatically packaged with the generated pattern plug-ins. For more information about packaging user-defined patterns, see Packaging and distributing pattern plug-ins.