CA Gen

Expand all | Collapse all

REST Services outside the mainframe - Java-based solution

Jump to Best Answer
  • 1.  REST Services outside the mainframe - Java-based solution

    Posted 02-03-2020 04:51 AM
      |   view attached
    During the recent CA Gen Product Roadmap, Su Brude reported our current Development focus on mainframe CICD, and mentioned Web Services Genius from Response Systems, as the only product to provide REST access to CA Gen server transactions.

    She is right, of course, from a pure "Product" perspective. However, if we talk about "Solutions" rather than products, the situation is different.

    Broadcom Mainframe Services - CA Gen Services Team, has been providing a Java-based Field-Supported Solution for a while now. This solution, called the Web API Designer for CA Gen, provides REST services:
    • From the simplest (individual services, which propagate the server Import / Export interfaces to REST)
    • To the most sophisticated (full Resource-Oriented Web APIs, giving access to multiple CA Gen servers, with extremely flexible coupling between resources/attributes and views), ready-made for external publication and consumption.
    With this solution, CA Gen servers can be accessed on all conventional platforms, using EJB or Java Proxy interfaces.

    As said, and that's the reason why Su didn't mention it, this is not a Broadcom Mainframe Division Product, but a Field-Supported solution, meaning that a separate contract needs to be set up with Broadcom Mainframe Services, and that Support and Maintenance of the solution goes through the Mainframe Services channel, to the CA Gen experts team, not to the normal Support lines.
    If you're interested, have a look at the attached Solution Brief, then contact me at your best convenience.

    Attachment(s)



  • 2.  RE: REST Services outside the mainframe - Java-based solution
    Best Answer

    Posted 02-04-2020 10:11 AM
    Thank you for sharing this with our community, @Christian Kersters!​

    ------------------------------
    Lenn Thompson
    Community Manager, Mainframe Division
    Broadcom Inc.
    lenn.thompson@broadcom.com
    ------------------------------



  • 3.  RE: REST Services outside the mainframe - Java-based solution

    Posted 02-04-2020 10:52 AM

    …and why you not provide it normally with the toolset just like what you did with SOAP web services generation?




  • 4.  RE: REST Services outside the mainframe - Java-based solution

    Posted 02-04-2020 01:15 PM
    Saeed,

    Thanks for your feedback.

    The main difference is that the Web Services Wizard, as this is what you refer to, is part of the CA Gen set of products, developed by CA Gen Development team, distributed as part of the product and covered by the same maintenance contract.

    In our case:

    • Simply giving away the Web API Designer, could imply liabilities to Broadcom, not limited by any contractual framework
    • Transforming it into a Product would mean a major effort, likely rewrite of much of it, as we're using different technology stacks. Effort would probably mean a total rewrite of the solution.


    ------------------------------
    Christian Kersters
    ------------------------------



  • 5.  RE: REST Services outside the mainframe - Java-based solution

    Posted 02-05-2020 02:57 AM
    Thanks Christian,

    I got your point.

    This solution is covering generating RESTful APIs from EJBs which is great achievement, but how about RESTful API consumption from Gen Java applications?


  • 6.  RE: REST Services outside the mainframe - Java-based solution

    Posted 02-05-2020 04:08 AM
    Saeed,

    Currently, there is no CA Gen support for consumption of REST services in Java. Starting from API documentation, however, this is generally quite easy to achieve in an EAB or Inline code.

    I've done it a lot with REST APIs generated by the Web API Designer. Here is how I proceed:

    1. Depending on the target framework and type of API (Gen-based, with Import/Export view straight mapping, or Resources-Oriented), the Web API designer generates all or a subset of the following documentations: RAML, OpenAPI, Enunciate (human-readable HTML format) and Swagger, WADL through Enunciate
    2. Next step is to start from one of the documentations and generate a "Data Model" for the target language, Java in your case. (The data model is a set of classes that you can use to easily generate / parse messages exchanged with the server). (Enunciate also automatically generates basic code for the data model in the most common programming languages)
    3. For Java (or C with gSOAP), I personally start from the WADL generated by Enunciate and use Apache CXF to generate the Java classes for the data model, but there are tools available to do it, for instance from OpenAPI (see https://openapi.tools/#sdk)
    4. Using Apache CXF again, I go to my EAB and write code with main content like this:
    Client publicClient = ClientBuilder.newBuilder().newClient();
    WebTarget rootPublicTarget = publicClient.target("<REST service URL>");

    WebTarget target = rootPublicTarget.path("Models").path(modelId).queryParam("accessKey", accessKey).queryParam("ency", encyName);
    Invocation.Builder builder = target.request();
    Response response = builder.get();
    if (response.getStatus() < 300) {
    com.ca.optsv.gen.cidp.rest.Model modelDetails = response.readEntity(com.ca.optsv.gen.cidp.rest.Model.class);
    lastCseUpdateDate = modelDetails.getLastCseUpdateDate();
    lastCseUpdateTime = modelDetails.getLastCseUpdateTime();
    name = modelDetails.getName();
    owner = modelDetails.getOwner();
    }

    StateData stateData = globdata.getStateData();
    stateData.setExitState(response.getHeaderString("StatusCode"));
    stateData.setExitInfoMsg(response.getHeaderString("StatusMessage"));
    stateData.setExitMsgType(response.getHeaderString("StatusSeverity"));


    Hope it helps. If you want more information, let me know.

    Thanks

    ------------------------------
    Christian Kersters
    ------------------------------



  • 7.  RE: REST Services outside the mainframe - Java-based solution

    Posted 02-06-2020 12:51 AM
    Btw, I've used this "Data Model" approach with XML messages only.

    For JSON, I haven't tested it, but used the JSON library instead (https://github.com/stleary/JSON-java)

    ------------------------------
    Christian Kersters
    ------------------------------