The issue in short
I have to integrate a mobile hybrid application that will probably be based on Ionic, and will have to (indirectly) consume a number of SOAP web services. I'd like the mobile app Typescript client to be aware of the beans defined by the XSD and WSDL files describing the web services.
Some additional explanations
In the following explanations I will refer to the following objects within the solution:
The following constraints are in force:
Let's say that some requests and responses used by the web services [C] involve the following Java object
public class MyElement {
private ElementColor color;
}
where ElementColor is a Java enum such as
public enum ElementColor {
RED,
GREEN,
BLUE,
}
These Java objects are defined in the WSDL and XSD files, hence we can build a JAR file, import it within the server-side application [B], and therefore our server-side application [B] will be aware of the possible values that the "color" property can assume within the MyElement class. All good.
My issue is that the Typescript mobile client [A] does not import the JAR file (obviously), hence when a client-side developer will have to write a request or parse a response that involves the MyElement object he will either
The second option is cleaner, but still not strongly tied to the actual models defined in the WSDL and XSD files, i.e. the client-side developer could still add a "YELLOW" value in his Typescript enum and send it to the backend.
I would like to automatically import/inherit within my Typescript codebase the models defined by the WSDL and XSD files, or the Typescript mappings of the Java classes generated from those same WSDL and XSD files. Mind that it is not enough to retrieve these objects at runtime (I could write a service that dumps them) because the client-side developer would still not be able to see them when developing.
Thank you in advance for your help.
So far the best approach I found to tackle this issue is leveraging something like this typescript generator plugin, which converts Java classes in Typescript classes.
I already had in place a Maven pom using cxf codegen plugin in order to turn WSDL and XSD files into Java code, I just had to add the typescript generator plugin execution to the process, so that the Java files are converted to Typescript files in turn. I can then import the Typescript definition files in my hybrid app project.