Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
midhun_vp
Active Contributor

Note: There is a known issue in this approach. Hence this will not work. I will update once it is fixed.

Some of the features that can be enabled using custom script in Integration Gateway (IGW) are: modify the requests and responses of an Odata request, handle delta token , multipart and composite WSDL support, and SOAP authentication. There are many examples in SCN on how to write custom script in Integration Gateway. In this blog I am explaining how to easily debug the script using IGW's eclipse based tooling.

From SMP SP06, debugging of custom script written in JavaScript is possible (Groovy supports in future). I have created a simple project using the WSDL http://www.webservicex.net/medicareSupplier.asmx?WSDL. High level details of the project is given below. Here I am not explaining how to create a project but I am explaining how to debug the script used in the project.

Odata Entity:

Custom Script written under function processRequestData

  //Import statements

   importPackage(com.sap.gateway.ip.core.customdev.logging);

   importPackage(com.sap.gateway.ip.core.customdev.util);

   importPackage(org.apache.olingo.odata2.api.uri);

   importPackage(java.util);

   importPackage(com.sap.gateway.core.ip.component.commons);

   importPackage(com.sap.gateway.ip.core.customdev.api);

   importPackage(org.apache.olingo.odata2.api.processor);

   //Getting value from header

   var context = message.getHeaders().get("odatacontext");

   var City = context.getRequestHeaders().get("City").get(0);

   var child = new LinkedHashMap();

   child.put("key:City", City);

   message.setBody(child);

   return message;

How to start debugging ?

  • Open prop.ini file of SMP server (C:\SAP\MobilePlatform3\Server)  and add the property -Drhino.debugger.port=9123

     

  • From eclipse, click on down arrow next to debug menu and choose debug configurations.

    

If debug menu is not visible: Go to Windows > Customize Perspective. "Navigate to Commands group visibility" tab. Then select "Launch" option in the Availability Command Groups and click OK.

  • On the new window opened, provide below details:

    

  • Navigate to Source tab and provide the path to the script file and click on Debug.

   

  • Open JavaScript file and set a break point as given below.

    

  • Execute the Odata service from a rest client by passing City as header along with Authorization header.

    

  • It triggers the break point set in the Javascript. To see the data send from rest client (ie. City) add Expression String(child) as given below. If Expressions tab not visible: Go to Windows > Show view > Expressions.

Regards, Midhun

SAP Technology RIG

12 Comments
Labels in this area