Declaration of a complex datatype as a parameter is done by adding a special keyword __soap_type followed by the name of the defined complex type after normal parameter declaration in the parameter list. The type name is given as a string literal. The same syntax extension also applies to declaration of the return type. This is shown in the following example.

Example 17.7. Procedure Definition with Complex Datatype Parameters

We create a procedure that will accept an array of structures (as defined in the previous example) and return it to the client. It instructs the WSDL generator to assign ArrayOfSOAPStruct as the input parameter and return value types when WS.SOAP.echoSOAPArray() is exposed as a SOAP method. The type information is available to SOAP clients that read the WSDL description. Upon receiving an incoming SOAP request, Virtuoso converts the XML representation of the data, after validation, to the form

vector(vector([varchar],[integer],[real]), ...)

and passed to the WS.SOAP.echoSOAPArray . Failed parameter validation is reported to the client.

SQL> CREATE PROCEDURE WS.SOAP.echoSOAPArray (in inArray any __soap_type 'ArrayOfSOAPStruct')
            RETURNS any __soap_type 'ArrayOfSOAPStruct'
      return inArray;