Map Step:
- In webMethods, the “Map” step is a component of the Integration Server, which is the core runtime engine of the webMethods platform, the Map step is used within an Integration Server flow service to transform data from one format to another.
- When you add a Map step to a flow service, you can configure it to specify the source data and target data structures.
- It allows you to define mappings and transformations between different data structures, such as XML, flat files, databases, or other custom formats.
- You can use built-in functions and operators to perform data manipulation, transformation, and validation. The Map step provides a graphical interface where you can visually define the mappings by connecting fields from the source to the corresponding fields in the target.
Overall, the Map step in webMethods enables you to define data mappings and transformations, facilitating the seamless exchange of information between different systems and formats in your integration solutions.
Let’s do some hands-on to understand it better😊!!
Exercise -1: Obtain an input from the user by utilizing a variable named input1, and populate the output with the same value as the input.
Ans :
- Right-click on the server and click on new package and give it a meaningful name ex- WebMethodsDemo
- Inside the package create a folder with the same name
- Inside the folder create another folder with the name services
- Now right click on the folder and create a flow service with a meaningful name ex- valueMapping
- Now the package structure should look like below.
- Now create a variable with name input1 in the input section and in the output create a variable of type string with name output.
- Now add one map step in the flow service and also add a comment to the map step.
- Now it is time to map😊, now connect the input1 variable to the output variable and drop the input1 variable as we don’t need it in the pipeline(It is always a best practice to drop the unnecessary variables)
- Now it’s time to test our service😊, right click on the package and click on run as flow service.
- it will open a popup asking you to provide the input like below.
Now click ok to run it and see the result, it will look like below.
Exercise -2 : Populate the full name of an employee by giving the first name and last name.
Ans:
- Create a flow service in the same service folder with a suitable name ex- fullnameService.
- Now in the input create two string variables with names- firstName and lastName(variable start name should be small case as per the coding standard), and in the output create a string variable with name – fullName.
- Now add one map step(Note : we are not considering the null firstName or lastName here that will will cover in upcoming blogs).
- Now will achieve this using variable substitution.(Variable substitution in webMethods refers to the ability to dynamically replace placeholders or variables within configuration files or service inputs with actual values at runtime. It allows you to parameterize your configurations and services, making them more flexible and reusable.)
- Now double-click on fullName variable in the pipeline out or right-click on the fullName in the pipeline out and click set values, it will open a pop-up to hard code the value.
- As I said you can hard code the value but in our case we need to extract the value from firstName and lastName variables and form the fullName, in the value field write something like this
%firstName% %lastName%. - If you notice we have enclosed each variable with % and have given a space in between so that the full name will be populated, this is how we do the variable substitution.
- Please make sure that you have checked to Perform Variable Substitution option otherwise it will not pick the values from both the variable at run time it will give the output as %firstName% %lastName% instead of the actual value.
- Now as I have already mentioned don’t forget to drop unwanted variables.
- Now run the service by giving firstName and lastName.
- Now click ok to run the service and see the results.
- Congratulations we have successfully completed the 2nd exercise😊!!.
Exercise -3: Accept input from the user using the variable called as inputStr and make it uppercase and produce output using the variable called as result(use a transformer to achieve this goal).
Ans:
- Create a flow service called as convertString.
- Now create input and output.
- Now add one map step and see the pipeline.
- Now right-click on the transformer and –>add transformer–>browse and select (wmpublic–>pub–>string–>toUpper).
- Now it’s mapping time, map inputStr to inString and value to result(Do not forget to drop inputStr after mapping as we don’t need it).
- Now it’s time to test, run it as a flow service, and provide “harmoniGate” in inputStr.
- Hope you have run it, let’s see the output.
- Cheers, we did it🍻!Need the package ????Click on the download button to download it!!
Steps to install Package :
- Copy the downloaded file and paste it in the below location: “C:SoftwareAGIntegrationServerinstancesdefaultreplicateinbound”
- Login to IS.
- Expand Packages–>click Management–>click install inbound release.
- Now select the package and click install inbound release.
- Cheers, it’s done, you can go through the package in your designer.Hope you have enjoyed this article, if yes please share it and drop a comment😊.
- Create a flow service called as convertString.