Connect Appserver of progress open edge through node.js - node.js

Does anyone have experience, information or some (coding) examples about a solution to establish a connection between the appserver of progress and node.js!? The aim is to create REST-Services to the db which can be accessed by the web like an angular-app.
Thanks for any advice
Christian

Starting with 11.2 (and enhanced in later versions) you can create REST-based applications utilizing the AppServer as a platform. ProDatasets are used as output (they convert easily to xml and/or json).
This is all explained in the Web Services part of the documentation. I'm providing a link below.
Basic steps
You need to consult the manual for all these steps...
Create an ABL program with input parameters (could be a parameter, a temp-table or a dataset) and and a single output parameter (could be a temp-table, a dataset or a single character or longchar parameter).
Add ABL-specific REST annotation to the program
Map the parameters in OpenEdge Studio
Setup REST agents with the restman utility
Export a "WAR-file" and deploy your webservice.
Calling the web service from node.js should be no greater problem than calling any REST based web service.
In versions prior to 11.2 you can "fake it and make it" utilizing WebSpeed. You can create a webspeed program that read parameters from the query-string (using get-field()) and then writes a response to the "webstream". Use either the WRITE-XML or WRITE-JSON methods on a temp-table or a dataset for writing the result. Don't forget to add a good MIME type though... This might not be as robust and customizable but it will work...
OE 11.4 Product Documentation - Web Services See chapter "II Creating OpenEdge REST Web Services"
These might also be useful:
OE 11.4 Product Documentation - Working with XML
OE 11.4 Product Documentation - Working with JSON

Related

Using Azure SDK for JS to create .NET 4.x App Service

I'm starting to wonder whether this is the right tool for the job, still here goes.
I'm attempting to automate the creation of our Azure Test environment using Azure SDK for JS. The environment spans many services (as you can imagine), including Classic ASP.NET app services.
Node is my safe space, so that is why I started with the JS SDK.
I have started scripting the creation of an app service using WebSiteManagementClient.webApps.createOrUpdate. I'm confused though, there is seemingly no way to configure any of the following:
Which app service plan the app service should be connected to. This feels fundamental.
The operating system, Windows or Linux.
The stack version, .NET 4.8, .NET Core, or whatever.
Is it possible to configure the above using the JS SDK, or am I going to have find another approach?
Update 23/03/21
Untested, but these are my findings so far:
App Service Plan - The plan is set using the serverFarmId property of the Site interface.
Operating system - Assuming Windows as the default, if you want a Linux app service, you change the kind property of Site from app, to app,linux.
Stack & version - In the SiteConfig interface, you have linuxFxVersion and windowsFxVersion. Again, I think the assumption is 'latest .NET' (e.g. .NET 4.8). For .NET Core 3.1, the setting looks to be DOTNETCORE|3.1.
It can be achieved using js SDK. I checked the source code and it is ok. But I don't recommend to use js sdk to do this.
Because you need to call the SDK, there are many internal logics that you need to code. This will waste a lot of your time. So I recommend you to use restapi.
The restapi method name is similar to the naming in the SDK, mainly because you can test api interfaces online to achieve the functions you want. So you can selectively choose the method you want to achieve the function you want.
Official doc
Web Apps - Create Or Update
As for your concerns, you only need to write all the configuration in json format and put it in the request body.
Tips:
First use the online interface, encode the json format, create a webapp according to your needs, and then integrate it into your code.

Post Service call with Multiple records

I would like to know how to post multiple records to SAP using "BatchRequestBuilder" along with ChangeSet .I am using a custom odata service call(ODataCreateRequestBuilder),not using the VDM model. I did'nt get any blog or documentation to start with.
Can you please help me in this regard.
Updated:
Below is what I am trying to post to SAP
[{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""},{"purchaseSchAgrmntNo":"","customerMaterialNumber":"","plant":"","vendorNo":""}]
SAP SDK version : 3.9.0
I have added below code with only one CreateRequest.
ChangeSet changeSet = new ChangeSetBuilder().addCreateRequest( ODataCreateRequestBuilder.withEntity(sapConfig.getServiceUrlRepriceList(),
sapConfig.getEntityRepriceList())
.withBodyAsMap(responseBody)
.build()).build();
BatchResult batchResult = BatchRequestBuilder.withService("URL?").addChangeSet(changeSet).build().execute(httpClient);
Can you let me know if this is correct.Also let me know what I have to pass in the service.Is it service URL?
Thanks,
Arun Pai
The BatchRequestBuilder is actually not directly part of the SAP Cloud SDK but a dependency that the SDK internally uses to execute batch requests. That is why on the SDK level there is no documentation on how to use it.
Roughly, a batch request comprises of multiple change sets which in turn group together multiple operations. The ChangeSetBuilder allows you to build up change sets which you can then pass to a BatchRequestBuilder.
So if you want to run create requests in batch mode you would want to leverage public ChangeSetBuilder addCreateRequest(ODataCreateRequest oDataCreateRequest).
You can take a look at how the SAP Cloud SDK uses these classes to build up batch requests to get an idea how it works in detail. As a starting point look towards BatchFluentHelperBasic. However, unless you don't know the service you want to query at compile time, I recommend that you leverage the generator to generate this code so that you can use the VDM instead which simplifies this.
If you extend your question to hold more specific information on what you actually want to achieve I can expand my answer to give a more concrete example. Also please include the SDK version you are using.

Use TemplateContext instead of TemplateContext?

I just upgraded my project from ServiceStack 5.1 to 5.5.1. Now where I am using TemplateContext from ServiceStack.Templates it tells instead to use TemplateContext. Needless to say, this is likely a mistake in the description for the Obsolete attribute. What is the appropiate replacement for TemplateContext now in ServiceStack 5.5.1?
The depreciation message should’ve said to use ScriptContext instead.
In the latest ServiceStack v5.5 Release ServiceStack Templates has been rebranded to #Script.
The section on Migration to new Script API's explains how to migrate in more detail:
Migrating to the new APIs is fairly straight forward:
Change using ServiceStack.Templates; to using ServiceStack.Script;
Any classes with TemplatePage* has been renamed to SharpPage*
Any other class with a Template* prefix has been renamed to Script*
This change doesn’t affect any of your existing #Script source code whose existing syntax and available filters/methods remains unchanged.
New Terminology
The primary rationale for the rebranding was so we’re better able to label, describe and document all of #Script different features easier, so when referring to Templates View Engine we’re now calling Sharp Pages which is a better corollary to “Razor Pages” which it provides an alternative to.
Other re-branded features:
API Pages are now called Sharp APIs
Web Apps are now called Sharp Apps
Template Filters are now called Script Methods
Template Blocks are now called Script Blocks
The collection of methods you inject in your scripts like TemplateRedisFilters and TemplateDbFilters are now referred to as “Scripts” where they’ve been renamed to RedisScripts and DbScripts.

Opensource IAM tool used in development

I am looking for an Opensource lightweight IAM to be used in development as a substitute for the real commercial IAM in production. Something with basic IAM functionalities, easy to install & easily configured to inject HTTP headers like user group.
Is OpenAM a good option? Any recommendations?
OpenAM comes from a very good pedigree...is forked from OpenSSO which is open-sourced code from the original SUN Access Manager product. OpenSSO was abandoned by Oracle after the Sun acquisition, so another company took it over and promoted a developer community around it.
Overall its a good choice for your requirements; that is:
Production-ready - yes, this version and previous versions have been used in production implementations
basic IAM functionality - it contains basic web access management functions and more than a few advanced features.
Inject HTTP headers - Yes, this is a standard function among web access management products.
In the past, a limitation with OpenAM/OpenSSO is that it required Sun Directory as the configuration store; however, this has changed with recent releases allowing other directories to be used.
Expect that installation and configuration of OpenAM to be rather command-line intensive; that is, with a minimal package installation and then options set in config files or thru utilities.
Hope that helps...

svcutil.exe - How to get WSDL

I'm working with a SOAP interface. The interface provider is having trouble getting me the full WSDL (long story). They have asked me to use svcutil.exe to generate everything I need. From what I can tell, svcutil.exe
requires windows - I don't have a windows box available
generates C# or VisualBasic
It'd be great if it could just spit out a WSDL. Or if there's something I can do from Linux, that would be great too.
Do I have any options from here, or do I just have to wait for the provider to get me the WSDL.
I guess the question is, given a URL and instructions to use svcutil.exe, how can I write code to use a SOAP service only using Linux?
If using linux you could save it via curl
curl url > service.wsdl
so to get a weatherForcast WSDL
curl http://www.webservicex.net/WeatherForecast.asmx?WSDL > weatherForcast.wsdl
#grantk has already demonstrated the easiest method: if you know where the WSDL is hosted, you can simply fetch the document using your tool of choice.
But as you asked specifically about using SVCUtil: you could find a windows box, use SVCUtil to fetch the WSDL, and then return to your linux (and Java?) stack and generate client proxies from that WSDL to call the service using your web service framework of choice.
If the target service supports WS-MetadataExchange or XML Web Service Discovery, SVCUtil will locate and download the WSDL for you: see this HowTo on Microsoft's MSDN web site.
Using the weather forecast service example that #grantk used, you can ask SVCUtil to query the service and download metadata as follows:
svcutil /t:metadata http://www.webservicex.net/WeatherForecast.asmx
(I'm sure there are similar tools to do this using WS-MetadataExchange in the linux world, but my experience is with SVCUtil.)

Resources