<any> wildcard elements

XML Schema

The <any> element comprises the XML representation for a wildcard schema component.

The <any> element appears in the content models of the <choice>, <sequence>, <appinfo>, and <documentation> elements (of which, <sequence> is relevant for Notes® and Domino®). The presence of "minOccurs" and/or "maxOccurs" attributes is permitted, allowing the corresponding instance elements to be either absent or multiple in number (default minOccurs and maxOccurs are both "1"). The <any> element also permits a "namespace" attribute, whose value determines which elements (from which namespace/s) are permissible in an instance. <any> elements may be adjacent within a content model (one following another within a <sequence>), however if so, their respective namespaces must not overlap, nor may they present ambiguities with any other adjacent elements, otherwise the schema is considered to be invalid.

WSDL 1.1

A value of "xs:any" may also be used to directly describe a <message> <part> in a WSDL document, e.g:

<message name="fooInput">
    <part name="fooArg" element="xs:any"/>
        </message>

This use results in typing the input and/or return arguments for a service operation.

Java (JAX-RPC and Axis 1.1)

The JAX-RPC 1.1 specification prescribes the Java javax.xml.soap.SOAPElement interface as the Java mapping for the <any> element.

In Notes/Domino 7.x, the underlying Axis 1.1. implementation actively supports <any>, by generating corresponding Java class members of type org.apache.axis.message.MessageElement, and de/serializing them at runtime. Insofar as the MessageElement class is an implementation of the SOAPElement interface (and then some), it satisfies the JAX-RPC 1.1 requirement. However, the MessageElement class exposes 90+ public methods, many of them for internal use. Accordingly, <any> support in Notes/Domino 7.x was disabled due to the size/complexity of the exposed MessageElement class.

For Domino® 8 Java Web services, <any> XML Schema <element>'s and WSDL 1.1 service operation input or return types will be imported as javax.xml.soap.SOAPElement interface types only (rather than as the underlying, verbose Axis 1.1 MessageElement class). Alternatively, javax.xml.soap.SOAPElement members of Java value type classes will generate to WSDL as <any> elements within <sequence> elements of some <complexType>; and SOAPElement input or return types to Java service operations will generate to WSDL only for "wrapped" services, which can express the generated <any> elements in valid XML Schema syntax, within a parent <sequence> element within a <complexType>.

javax.xml.soap.SOAPElement objects can be instantiated in a Domino® 8 Web service through the use of the java.xml.soap.SOAPFactory class. Supported SOAPElement operations are those which are specified for the javax.xml.soap.SOAPElement interface, and its related interfaces in the javax.xml.soap package. The following example illustrates how one might instantiate, populate, and return a SOAPElement object in a Domino® 8 Java Web service:

import javax.xml.soap.*;
public class PortType {
  public SOAPElement getAny() {
    try {
      SOAPFactory SF = SOAPFactory.newInstance();
      SOAPElement SE = SF.createElement( "anyPart", "ns", "theNamespace" );
      Name nam = SF.createName( "xsi:type", "xsi", "http://www.w3.org/2001/XMLSchema-instance" );
      SE.addAttribute ( nam, "xsd:string" );
      SE.addTextNode( "The quick brown fox" );
      return SE;
    } catch (SOAPException se) {
      se.printStackTrace();
    }
  return null;
  }
}

LotusScript®

For Domino® 8 LotusScript® Web services, <any> XML Schema <element>'s and WSDL 1.1 service operation input or return types will be imported as NotesDOMElementNode backend class instances. Alternatively, NotesDOMElementNode members of LotusScript® value type classes will generate to WSDL as <any> elements within <sequence> elements of some <complexType>; and NotesDOMElementNode input or return types to LotusScript® service operations will generate to WSDL only for "wrapped" services, which can express the generated <any> elements in valid XML Schema syntax, within a parent <sequence> element within a <complexType>.

Generated WSDL value type <any> elements will include the namespace attribute value of "##other", defined by XML Schema to indicate "not the targetNamespace for the ancestor <schema> element". This prevents overlap between the legal namespaces for the generated <any> and the default namespace for explict, adjacent <element>'s, and thereby lessens the need for WSDL fixups and reimporting.

For example:

This WSDL complexType:

will import to Java as:

will import to LotusScript® as:

This WSDL wrapped operation:

will import to Java as:

will import to LotusScript® as:

Whereas the WSDL operation:

will halt WSDL import, with an "invalid WSDL" message

whereas:

These implementation constructs:

will export to WSDL as:

Java:

public class Address {
   private javax.xml.soap.SOAPElement any;
   private java.lang.String street;
   private javax.xml.soap.SOAPElement any1;
   // housekeeping, getters/setters
}

LotusScript®:

Class Address
    Public any As NotesDOMDocumentNode
    Public street As String
    Public any1 As NotesDOMDocumentNode

    Sub NEW
    End Sub
End Class
<complexType name=address">
  <sequence>
    <any namespace="##other"/>
    <element name="street" type="xsd:string"/>
    <any namespace="##other"/>
  </sequence>
</complexType>

or with upper-case name attributes for LotusScript®.

And these implementation constructs:

will export to WSDL as:

Java:

public class PortType {
  javax.xml.soap.SOAPElement getAny() {
    return null;
    }
}

LotusScript®:

Class PortType {
  Function getAny() As NotesDOMElementNode {
  }
}

for wrapped services only:

<types>
  <schema>
   <element name="GetAnyResponse">
     <complexType>
       <sequence>
         <any />
       </sequence>
     </complexType>
   </schema>
  <types>

  <message name="GetAnyResponse">
    <part element="impl:GetAnyResponse"  name="parameters"/>
  </message>

non-wrapped services will halt during any save or show WSDL operation on an "invalid WSDL" error message.