Sometimes the transformations needed to process incoming or outgoing XML messages are more complex than you can accomplish with static XML maps. In these cases, you can use WebLogic Workshop's extended version of ECMAScript to perform XML mappings. To do so, you must first create a script file (with a JSX extension) in your project to hold the script.
To Create a Script File
The newly created JSX file contains two functions named myScriptFromXML and myScriptToXML. These are used to map from XML to Java types and to XML from Java types. The newly created JSX file also contains some rudimentary instructions about how to use the script from a map.
From within a map, script may be called by using the following syntax:
{ScriptFileName.myScript(parameters)}
Notice that the function name in the call does not include ToXML or FromXML. The appropriate method in the JavaScript file is determined automatically based on the direction of the mapping being performed.
The value of parameters depends on whether you are mapping the parameters or the return value of your Java declaration. If you are placing the call to script in a parameter-xml map, parameters should be the arguments of the method or callback that you would like this script method to populate. If you are placing the call to script in a return-xml map, you should simply enter type return, where type is the method or callback's declared return type.