Summarizing the Problem
I am faced with the task of integrating a mobile hybrid application, likely built on Ionic, that will need to indirectly consume several SOAP web services. My goal is for the TypeScript client in the mobile app to have knowledge of the beans outlined in the XSD and WSDL files that describe these web services.
Further Details
In this scenario, I will be referring to the following components:
- the TypeScript client of the mobile app [A]
- the Java application tailored for the mobile server-side operations [B]
- the remote SOAP web services exposing business functions [C]
The following restrictions are at play:
- the mobile app client [A] will interact via REST calls with a distinct server-side application [B]
- the server-side application [B] will be developed using Java and will handle the consumption of existing web services [C], acting as a mediator between the TypeScript app client [A] and SOAP web services [C]
- the SOAP web services [C] are detailed in multiple WSDL files, supported by corresponding XSD files; the backend team is adamant about retaining their documentation in WSDL and XSD
For example, certain requests and responses within the web services [C] involve the Java object below:
public class MyElement {
private ElementColor color;
}
where ElementColor represents a Java enum similar to:
public enum ElementColor {
RED,
GREEN,
BLUE,
}
These Java objects are defined in the WSDL and XSD files, enabling us to generate a JAR file, import it into the server-side application [B], and ensure our server-side app [B] recognizes the possible values for the "color" property in the MyElement class. All is well up to this point.
However, my concern arises when the TypeScript mobile client [A] does not have access to the imported JAR file. Consequently, when a developer works on code related to the MyElement object, they either:
- treat the "color" field as a String (risking input of invalid values, not limited to "RED", "GREEN", or "BLUE")
- create a TypeScript enum resembling the ElementColor Java enum.
The latter option is cleaner but still lacks a strong connection to the actual models specified in the WSDL and XSD files; there is a chance a developer could introduce an additional "YELLOW" value to the TypeScript enum and send it to the backend.
My objective is to effortlessly incorporate/inherit the models from the WSDL and XSD files, or TypeScript mappings of the Java classes derived from those same WSDL and XSD files, into my TypeScript codebase. It should be noted that merely retrieving these objects at runtime (e.g., through a service) is insufficient since the developer working on the client side would still not have visibility during development.
Thank you for any assistance that can be provided.