17.1.2.Handling of SOAP HTTP Requests
The Virtuoso web server recognizes SOAP HTTP requests and their
version in the POST method handler. When SOAPMethodName
or SOAPAction
HTTP header attributes are
present with
Content-Type: text/xml
, the server initiates SOAP call handling. The XML namespace of the SOAP method name is stripped off and Virtuoso searches for a stored procedure with the same name, ignoring case.
The search is done within the default qualifier of the SQL user account assigned for SOAP call execution defined for the virtual host. For example, if the database user assigned in the virtual host's definition for SOAP execution is called SOAPDBUSER and this user has a default qualifier 'SOAPDB' and the request contains an invocation of method called
OurSoapMethod
, Virtuoso would attempt to find a stored procedure named
SOAPDB.SOAPDBUSER.OurSoapMethod
.
When a matching stored procedure is found, any of its parameters that have names matching parameter entity names in the SOAP call are bound to the call parameter. The parameter name match is also case-insensitive.
Virtuoso maps the procedure parameter datatypes internally by casting from XML data (a string) to the declared parameter datatype of the stored procedure. There is one exception: When an array is being passed, the server creates an array with values of types inferred from the XML Schema of its elements. It is possible to declare that a user defined SQL type be used to represent a specific XML element in a SOAP request. Thus SQL objects can be constructed and serialized automatically. Note that this also means that the implementation of the user defined type instance may be in a hosted language, thus Java or CLR code may be transparently involved.
Two special parameters - ws_soap_headers
and ws_http_headers
- are available to a
stored procedure handling a SOAP method invocation. If declared as
input parameters for the procedure, ws_soap_headers
must contain an XML
parse tree of the SOAP:Header
in same format as
returned by xml_tree()
.
ws_http_headers
should hold
a one-dimensional array of attribute/value pairs representing the
HTTP header fields in the request.