This post is to understand about "Script connector" and how to configure it. Understanding the necessity of script connector is best explained by explaining about the environment that I have been experienced to.
Step 8 : Attach the interface to be tested to script connector and test it. You would see the same response which you configured in the xml store.
Without script connector :
I was a part of a team which works on a framework called "Cordys" and which leverages the usage of its connector capability (able to connect to different systems which are in different platforms like .net, java etc.,) using pre-built connectors like UDDI, SAP Connector etc., As a part of the project we need to integrate with couple of systems and build a process performs a functionality by integrating with those systems. We use UDDI services, SAP Services etc., Hence the development of the process is a lot dependent on the implementation and availability of these services without which we won't be able to finish the implementation of the process.
It would be ideal if we remove this dependency and implement it. There is a way to implement it using a connector built by coe team of cordys which is "Script Connector". Advantages of script connector are
- It mimics the response(user configured response) from different system and hence we won't be depending on the availability of the main system instead we create a dummy system which responds like the way main response does.
- Implementation would be very smooth and doesn't need to depend on any other system.
- All possible cases can be tested without even bothering the main system.
How to mimic the response :
There are many ways to replicate the main system by dummy system, current explanation deals with mimic-ing the response by custom logic by retrieving the mimic-ed response from xml store of cordys.
Initial configuration of script connector :
In order to have script connector completely configured we need to install the script connector isvp in the environment. My cordys environment is "BOP4.1CU6", hence I would install an ISVP and this isvp can be found out from cordys wiki at this particular link,
Step 1 : Install the isvp
Step 2 : Go to your organization and try creating a new container. You will be finding a new entry for script connector as shown below,
Extra configuration to be made :
Here in this section this extra configuration is to be done in order to mimic the response for your service.
Step 4 : Find out what is the web service which you want to mimic. In my case it is "ConversionRate" for which I need to connect to internet and I don't have internet, hence I need to remove this dependency by using script connector.
Step 5 : Edit config.properties file located in the directory
<<CordysInstalledDirectory>>/coe/scriptconnector/config.properties by adding the below property
*=scripts/all.js --- This property says any service that you want to mimic can go and refer all.js file. Actual implementation is done at all.js file. I will try to attach all.js file as a comment to the blog post. One must have this file at the location
Step 6 : Have all.js file in the location mentioned above.
Step 7 : According to the implementation in all.js, we must configure our custom response in xml store. The mandatory things we need to make sure are,
- We must have a folder in xml store as shown below
- Now create a folder with the same name as your "WebServiceOperation" in my case it is "ConversionRate".
- Now create an Item with any name but which ends with suffix "-Cur" and put any response in that item. In my case it is "success-Cur". All these steps are shown in the below figure,
After testing with all possible cases and when we are done with the development from our side we can port these contents to whatever environment you want and connect the interface to the real system instead of script connector. Script connector should be used only in the development environment and not encouraged to be used in any other environments apart from development.