Friday, December 26, 2014

What is script connector and how to configure it ???

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.

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,
https://wiki.cordys.com/display/dsc/Script+Connector
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,

Step 3:  Go ahead and create the container normally.

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 
<<CordysInstalledDirectory>>/coe/scriptconnector/scripts/.


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
    • Collection->scriptconnector->all.js
  • 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,


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.



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.     

4 comments:

  1. Can you please add the all.js file.

    ReplyDelete
  2. https://drive.google.com/file/d/0B25humeDHAtFYnRlYkR5c0NtTUk/view?usp=sharing

    ReplyDelete
  3. Hi Kiran,

    I have a question regarding this. If you can guide.

    There is already a script connector configured to send the response and based on requirement we attach the webservice to either UDDI or Script connector. The requirement is to send dummy response based on certain condition when the webservice is attached to UDDI connector.

    Is it possible to achieve using script connector?
    any guidance will be helpful.

    ReplyDelete
  4. Hey Devendra Sahu,

    Sorry for late response.
    I don't think you can achieve whatever you are telling straight away.

    In order for script connector to work, I think you should attach interface to script connector only and it will trigger some function in all.js. What you want can be done by tweaking something in this function.

    I would suggest you one thing,

    Let's say you have two organizations, attach the interface to script connector in one organization and UDDI connector in other organization and in all.js route the request to other organization based on whatever condition you want. Then the request would go to other organization where the interface is attached to UDDI which will serve your purpose.

    I hope I am clear in explaining.

    ReplyDelete