SAP Business One Service Layer – TypeScript autogeneration
In a previous blog SAP Business One Service Layer HANA XS sample I shared with you a sample we have developed in HANA XS (Java Script) connecting to SAP Business One Service Layer. In this blog I’ll like to give you some details about the TypeScript auto generation source code that was used to create the client side proxy class “B1SLReference.js”.
The auto generation source code includes two C# .NET solutions:
- oDataClassesGenerator – Generates a TypeScript or Java Script file out of the SAP Business One Service Layer metadata file.
- TypeScript – .NET application using the TypeScript autogenerated file from oDataClassesGenerator.
How to get this application working in your environment
oDataClassesGenerator .NET solution
- Extract and unzip the Autogeneration.zip file and open the oDataClassesGenerator solution.
- Run the solution:
- choose if you want to generate a Java Script or a Type Script file
- select your xml file containing the Service Layer metadata.
- To generate your Service Layer metadata establish a connection to Service Layer via Postman for example and retrieve the metadata file (after a successful login, use the metadata link to ask for the Service Layer full metadata, save the response as an xml file). For more details on metadata file please check the User Guide at: https://yourhanaserver:50000.
- Read carefully the “ModifsMetadata.txt” file (inside the Autogeneration.zip, ODataClassesGenerator folder). Some small changes are required to be applied to the metadata original file in order to have the classes auto generated by this application.
TypeScript .NET solution
You can find details about TypeScript at: https://www.typescriptlang.org/
You can download the source code of the full sample containing the different projects from here.