title: Interfacing a hybrid/web client application with existing remote web services described by a set of WSDL
body: <p><strong>The issue in short</strong></p>
  
  <p>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.</p>
  
  <p><strong>Some additional explanations</strong></p>
  
  <p>In the following explanations I will refer to the following objects within the solution:</p>
  
  <ul>
  <li>the mobile app Typescript client [A]</li>
  <li>the mobile-dedicated server-side Java application [B]</li>
  <li>the remote SOAP web services that expose the business functions [C]</li>
  </ul>
  
  <p>The following constraints are in force:</p>
  
  <ul>
  <li>the mobile app client [A] will communicate through REST calls with a
  dedicated server-side application [B]</li>
  <li>the dedicated server-side application [B] will be developed in Java
  the dedicated server-side application [B] will take care of consuming the existing web services [C], hence acting as an integration layer between the Typescript app client [A] and the SOAP web services [C]</li>
  <li>the SOAP web services [C] are described by a number of WSDL files, supported by some XSD files, the backend team is unwilling to rewrite their documentation to anything other than WSDL and XSD</li>
  </ul>
  
  <p>Let's say that some requests and responses used by the web services [C] involve the following Java object</p>
  
  <pre><code>public class MyElement {
      private ElementColor color;
  }
  </code></pre>
  
  <p>where ElementColor is a Java enum such as</p>
  
  <pre><code>public enum ElementColor {
      RED,
      GREEN,
      BLUE,
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>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</p>
  
  <ul>
  <li>treat the "color" field like a String (but then he could write any value to it, not just the valid "RED", "GREEN", and "BLUE" values)</li>
  <li>define a Typescript enum mimicking the ElementColor Java enum.</li>
  </ul>
  
  <p>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.</p>
  
  <p><strong>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.</strong> 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.</p>
  
  <p>Thank you in advance for your help.</p>