Generating XSDs from EMF ISO20022 repository - eclipse-plugin

I'm trying to generate the latest set of XSDs from the ISO 20022 repository which is provided in EMF format.
I have generated the Eclipse Plugin from the provided ecore implementation metamodel and can open up and view the repository from it.
At this point should I be able to generate the message XSDs for the list of message definitions in its Business Process Catalogue -> Message Sets? I don't see how?

Download from https://www.iso20022.org/message_archive.page XSD schema of the message (Pain.001, Camt.053 etc.) you want to implement and with the help of Eclipse, Java and JAXB you can get all data models in the form of Java classes.
Please refer to: How to get all the tags of basic data types from e-repository of iso20022?

Related

what is the easy way to manually parse the RAML file in mule?

In mule application I am trying to parse RAML file. I knew that APIKit is doing same as it creates flows after parsing the RAML file. But still, what if I want to parse it in middle of the flow manually?
I have seen the raml parsers available but not finding the proper usage of those javascript libraries or java libraries on how to use them in mule application..
Yes you can parse your RAML in your java application using java class or groovy component implementing java.
There are java parser available like RamlModelBuilder which you can use to parse your application RAML like validation of your RAML file, getting APIs name, getting all resources name, method name, scopes, security schema and their names, query parameters, headers and many more...
Just check the example how it is used here. You can simply create a java class and get your RAML parsed
https://github.com/anirban37/Anirban-Custom-Oauth-Policy/blob/master/Anirban-RAML-Oauth-V3/OauthPolicies.xml#L594.
ramlModelResult = new RamlModelBuilder().buildApi(ac.getRaml())
will give you the current RAML file access of the application in the java class
Theres nothing in Mule to work with the RAML file at runtime.
But you can create any Java component that uses RAML Java libraries and invoke that from Mule in your flows.
The Mule4 SDK is one way of extending mule through Java.
For more information on Mule SDK can be found here https://mule4-docs.mulesoft.com/mule-sdk/v/1.1/
You can also invoke Java classes but they need to be decoupled from the Mule API and you need to extract any variables, properties or payload and explicitly pass the values to your class. For example passing a static String and a flow var as arguments to a Java constructor:
<java:new class="com.foo.AppleEater" constructor="MyClass(String, Apple)">
<java:args>#[{name: 'some string arg', apple: vars.apple}]</java:args>
</java:new>
In your class you could use the RAML Java libraries, and pass the file or path to RAML file to load from the classpath.
More on Java integration with Mule 4 here: https://docs.mulesoft.com/mule-runtime/4.1/intro-java-integration

How to create a custom NiFi Controller Service?

I am trying to learn, how to create a custom NiFi controller service. To start off, I thought of mimicking the DBCPConnectionPool controller service by simply copying the original source code of DBCPConnectionPool service. To implement the same, I generated a maven archetype from "nifi-service-bundle-archetype" and got the following project structure
However, when i generated the archetype from 'nifi-processor-bundle-archetype , I got the following structure: -
I understand that in case of processor I simply need to write my code in MyProceesor.java present under nifi-ListDbTableDemo-processors folder and then create a nar file out of it. But in case of controller service, I have 4 folders generated. I can see two java files i.e.
StandardMyService.java present under nifi-DbcpServiceDemo folder
MyService.java present under nifi-DbcpServiceDemo-apifolder
Now, why is there two java files generated in case of custom controller service, while there was only one java file generated in case of custom processor. Also, Since I am trying to mimick the DBCPConnectionPool service, in which java file out of two should I copy the original source code of DBCPConnectionPool service.
Please guide me from scratch, the steps that I need to follow to create a custom service equivalent to that of DBCPConnectionPool service.
MyService.java under nifi-DbcpServiceDemo-api is an interface which be implemented by the StandardMyService.java under nifi-DbcpServiceDemo. Once the implementation is done, you have to use nifi-DbcpServiceDemo-api as dependency in the processor bundle which needs to work with this custom controller Service.
The reason why controller services are implemented this way is:
We will be hiding the actual implementation from the processor bundle because it need not depend on the implementation.
Tomorrow you write a new controller service implementation, say StandardMyServiceTwo which again implements MyService because only the implementation varies from StandardMyService and other members remains the same and can be shared. This new controller service can be introduced transparently without making any changes on the processor bundle.
Example:
The best example is the record reader/writer controller services. If you look at the nifi-record-serialization-services-bundle in nifi, they have different implementation for serializing records of JSON, Grok, avro, CSV data formats but they all are actually implementing one API - nifi-record-serialization-service-api And hence for the processors which want to use the Record Reader or Record Writer, instead of having the actual implementations as its dependency, they rather can have the api as its dependency.
So tomorrow you can add add a new implementation in the record-serialization-services-bundle for a new data format without touching anything on the processors bundle.
For you references, please take a look at the following links which would help you in writing the custom controller service from scratch
http://www.nifi.rocks/developing-a-custom-apache-nifi-controller-service/
https://github.com/bbende/nifi-dependency-example

Swagger JaxRs combining generated sources with existing model

I am using Wildfly 9.1, swagger-jaxrs 1.5.3 and swagger-codegen-maven-plugin 2.1.3
We try to combine an API (with its own model and services) defined by swagger and our database model generated by our own generator.
Our Generator already adds the annotations needed by swagger to recognize it as resources to the API.
We now try to dynamically generate the model defined by swagger in compile time (swagger-codegen-maven-plugin) which works nice as long as we do not want to use classes of our other mode.
The two problems i have are:
when writing the swagger spec i use to generate the files for the new api i am not able to reference the objects defined by our database model
if i now add these objects to the swagger model to prevent this problem (either by adding a dummy or by generating the .json from the existing entities) The classes generated by swagger obviously expect them to be in the same package.
I am searching for a smart way to combine both approaches without losing the opportunity of developing the API by editing the swagger spec.

Naming XSDs in wsdl generated by WCF

We are working on a WCF service which is being consumed by BPEL. When BPEL imports the WSDL, it reads the XSDs as below:
_
http://Server_Name/Service1.svc?xsd=xsd0
_http://Server_Name/Service1.svc?xsd=xsd1
_http://Server_Name/Service1.svc?xsd=xsd2
so on and so forth.
This random naming of XSDs is creating a lot of churn, as whenever there is a contract change, BPEL again reloads the entire WSDL and a random number suffix will be added to each XSD. BPEL team will have to then again open each XSD to find out the change.
Is there a way by which WCF can stop generating these random XSDs and give each XSD a proper name?
What about downloading and properly naming these XSDs during design time instead of linking to these resources? The benefit would be that schema changes are under your control. I think this is preferable as long as it remains unclear if and if so under what circumstances the BPEL engine may reload the XSDs from these resources. If the schema changes, it should me made known explicitly and a new version of the process model should be deployed.
To overcome this problem, We installed .NET 4.5 to generate single wsdl which properly names the XSDs and has no XSD import statements.

Automatic serialization

I want to download xsd specifications from a web service and automatic converting (serialize) these schemas to classes (visual studio - vb.net). If the organization that is responsible for the xsd schemas alter them in a way that only my class corresponding to the xsd have to be altered (not the rest of my code) I would like to automatic update my xsd corresponding class. Is this possible? If so, can somebody tell me how to do it?
Thanks!
I use vs2010. What I want to do is: call a web service where I can send in an input parameter to the service which specifies the xsd I want to retrieve (the service is GetShemaDefenition and returns an object with the schema specification in a string property of the object). I den have to read the xsd string from the string property and convert this to a class representation of this xsd specification. Is it possible to do this automatically? I have done this manually by using xsd.exe. If the owner organization of the xsd has altered the xsd specification, I have to test if there is a new specification, and if there is I have to build a new class representation of this xsd? Is it possible to do what I want? And how would I know if it has been a big change in the xsd which also affect other parts of my code, not just the class representation of the xsd?
Tanks a lot for your reply! So what you are saying, if I understand you correct, is that there is not a good solution for automating this functionality because if the xsd change I most likely (in some occasions’) have to change my code manually? So I have to choose, either in my application or in my intermediate service? But what is the purpose for providing the xsd in a web service? What can I use the web service for? I just wondering, maybe it is clear but I am new to web services and is eager to learn more.
Update:
Thanks! But can you explain a little bit more. What I have to do is: I use one web service where one of the properties is a string. The string is an XML inside a CDATA block. The organization which provides the web service will not pares the xml inside the CDATA block but instead forward this to another organization that will use the xml data. The organization which uses the xml data specifies the xsd schem that I have to follow to generate my xml correct. This is the xsd schema I can get from another web service. I don’t really understand what I can do with this xsd file from the web service. What can I do with it and why do I want to download it from the web service, when I can’t use it automatically? Because I have to manually do the changes when the xsd changes I can easily download the xsd schema from the organization’s home page and make the new class with xsd.exe. I understand there is something I don’t understand :o), can you pleas clarify?
What visual studio version you are using?, Normally you can click on the project's references and Add Web service. In this case Visual studio creates automatically the objects required to consume the service. you can update it any time by a right click on the reference.
However if it is very likely to change often, One solution is to implement an adapter class. use create an interface that provides the same functionality and call the actual web service. In your application you use only the proxy class and not the Web Service. Later when the web service interface changes all you have to do is to change the internals of this intermediate class.
Update:
you can use this tool to create you object model in code. Then you can compile your new object model and use it in you application. There are many complications in what you want to do and the bottom line is; when the object model changes, your code will fail. There is absolutely no way to imagine how the interface will change so while you can do all that automatically there is nothing to do if the name of a function changes.
However the answer to your situation is indirection. If you can't guaranty the stability of a external service. Why not create a stable intermediate service that calls the actual one? this way in future you don't need to touch you application. All you have to do is to modify the intermediate service while keeping it's interface compatible.