Sunday, May 27, 2012

WPS: Type Casting in WID :: Set Message Type & XSL Transformation

Introduction : we want to change the element from one type to other type. For this type of conversion we achieve in mediation component by two ways : Set Message Type & XSL Transformation

1. Set Message Type : Allows you to overlay weakly typed message fields with strongly typed message fields. You can then use the detailed message structures in other mediation primitives.

 select the component and then go to properties tab : go to details where you can set the message type.
 Weakly typed field : Specify the XPath of the weakly-typed field you want to refine.
Actual field type :Specify the data type you want to use for the refinement.
Reset message type :If true, causes the current mediation primitive to forget Message field refinements information from previous Set Message Type mediation primitives.
Validate :  If true, causes causes the Set Message Type mediation primitive to perform runtime validation. The validation includes all message fields and not just those that you have overlaid.
 

 
1.  click on add










2. Enter the weakly typed field by giving xpath or select the field by clicking edit.
3. Select the actual type by clicking on browse.
4. click on finish.
Note : The converted type will be available for the next primitive only. At run time, the Set Message Type mediation primitive does not affect the real structure or content of a message. The Set Message Type mediation primitive simply makes it easier for you to manipulate messages.

XSL Transformation :  Mediation primitive also allow to cast weakly typed message fields with strongly typed message fields.

select the weakly typed field and right click select "cast" it will give all the available types. we can able to convert the message type of element to modify the content.

Note : The type converted field scope is upto this map only.





















WPS (java): To create unique id(UUID) by using javacode.

import java.util.UUID;
UUID idOne = UUID.randomUUID();
// this random function will create new unique id.