title: Web service with a generic payload XML type "Any"
body: <p>I have developed a web service that accepts and responds with a common message structure. Meaning, this message structure is made to be generic. The way we made it generic is using the following XML schema: </p>
  
  <pre><code>&lt;xs:complexType name="HeaderType"&gt;
  &lt;xs:complexType name="MessageType"&gt;
  &lt;xs:complexType name="PayloadType"&gt;
  </code></pre>
  
  <p>where PayloadType is the following:</p>
  
  <pre><code>&lt;xs:complexType name="PayloadType"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;Payload container&lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:sequence&gt;
              &lt;xs:choice&gt;
  
                  &lt;xs:element name="CreateExceptionSeverity" type="cmsmsg:ExceptionSeverity" minOccurs="0"&gt;
                      &lt;xs:annotation&gt;
                          &lt;xs:documentation&gt;CreateExceptionSeverity is a hello world operation that takes in a app id, id, name, and description where the web service creates a new entry in EXCEPTIONSEVERITY table.&lt;/xs:documentation&gt;
                      &lt;/xs:annotation&gt;
                  &lt;/xs:element&gt;
                  &lt;xs:element name="OperationSet" type="cmsmsg:OperationSet" minOccurs="0"&gt;
                      &lt;xs:annotation&gt;
                          &lt;xs:documentation&gt;Each operation set is a collection of operations that may require operational-integrity and/or sequence control.&lt;/xs:documentation&gt;
                      &lt;/xs:annotation&gt;
                  &lt;/xs:element&gt;
                  &lt;xs:element name="Compressed" type="xs:string" minOccurs="0"&gt;
                      &lt;xs:annotation&gt;
                          &lt;xs:documentation&gt;For compressed and/or binary, uuencoded payloads&lt;/xs:documentation&gt;
                      &lt;/xs:annotation&gt;
                  &lt;/xs:element&gt;
                  **&lt;xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" namespace="##other"&gt;**
                              &lt;xs:annotation&gt;
                                  &lt;xs:documentation&gt;For XML payloads, usually CIM profiles defined using an XSD in a profile-specific namespace.&lt;/xs:documentation&gt;
                              &lt;/xs:annotation&gt;
                  &lt;/xs:any&gt;
              &lt;/xs:choice&gt;
              &lt;xs:element name="Format" type="xs:string" minOccurs="0"&gt;
                  &lt;xs:annotation&gt;
                      &lt;xs:documentation&gt;Hint as to format of payload, e.g. XML, RDF, SVF, BINARY, PDF, ...&lt;/xs:documentation&gt;
                  &lt;/xs:annotation&gt;
              &lt;/xs:element&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>So, the line:</p>
  
  <pre><code>&lt;xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" namespace="##other"&gt;
  </code></pre>
  
  <p>makes this structure flexible enough to send data when invoking the web service and when the web service sends back the response. This web service is deployed on a TIBCO server (uses Tomcat) and will be invoked through way of SOAP/HTTP.</p>
  
  <p>The client for this web service is a Java Spring web app. My question is: how can the Java code deal with this Any element because it requires a concrete XML type like integer, string, or a complex type? Any direction here will be much appreciated. </p>