12.30. Web Services Translator 12.30.1. Web Services Translator The Web Services translator exposes stored procedures for calling web services. The Web Services translator is implemented by the org.teiid.translator.ws.WSExecutionFactory class and known by the translator type name ws . The corresponding resource adapter may optionally be configured to point at a specific WSDL. Results from this translator will commonly be used with the TEXTTABLE or XMLTABLE table functions to use CSV or XML formatted data. See Section 2.6.8, "Nested Tables: TEXTTABLE" and Section 2.6.9, "Nested Tables: XMLTABLE" for more details. There are no importer settings for this translator, but it does provide metadata for dynamic VDBs. If the connection is configured to point at a specific WSDL, the translator will import all SOAP operations under the specified service and port as procedures. Note The resource adapter for this translator is provided by configuring the webservices data source in the JBoss EAP instance. See the Red Hat JBoss Data Virtualization Administration and Configuration Guide for more configuration information. Important Setting the proper binding value on the translator is recommended as it removes the need for callers to pass an explicit value. If your service actually uses SOAP11, but the binding used SOAP12 you will receive execution failures. 12.30.2. Web Services Translator: Execution Properties Table 12.31. Execution Properties Name Description When Used Default DefaultBinding The binding that should be used if one is not specified. Can be one of HTTP, SOAP11, or SOAP12 invoke* SOAP12 DefaultServiceMode The default service mode. For SOAP, MESSAGE mode indicates that the request will contain the entire SOAP envelope and not just the contents of the SOAP body. Can be one of MESSAGE or PAYLOAD. invoke* or WSDL call PAYLOAD XMLParamName Used with the HTTP binding (typically with the GET method) to indicate that the request document should be part of the query string. invoke* null - unused Important If you want to expose a virtual stored procedure as a SOAP web service which must implement Basic Auth, you will encounter an exception unless you set this property: 12.30.3. Web Services Translator: Usage The WS translator exposes two low level procedures for accessing web services: invoke and invokeHttp. 12.30.4. Web Services Translator: Invoke Procedure Invoke allows for multiple binding, or protocol modes, including HTTP, SOAP11, and SOAP12. The binding may be one of null (to use the default) HTTP, SOAP11, or SOAP12. Action with a SOAP binding indicates the SOAPAction value. Action with a HTTP binding indicates the HTTP method (GET, POST, etc.), which defaults to POST. A null value for the binding or endpoint will use the default value. The default endpoint is specified in the WS resource adapter configuration. The endpoint URL may be absolute or relative. If it is relative then it will be combined with the default endpoint. Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax. The request XML should be a valid XML document or root element. If the stream parameter is set to true, the resulting value document can only be read once. This is appropriate when directly passing the XML into XMLQUERY or XMLTABLE and only a single pass against the document is needed. If stream is null or false, then the engine may need to save a copy of the document for repeated use. 12.30.5. Web Services Translator: InvokeHTTP Procedure invokeHttp can return the byte contents of an HTTP or HTTPS call. Action indicates the HTTP method (GET, POST, etc.), which defaults to POST. A null value for endpoint will use the default value. The default endpoint is specified in the WS resource adapter configuration. The endpoint URL may be absolute or relative. If it is relative then it will be combined with the default endpoint. Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax. The request can be one of SQLXML, STRING, BLOB, or CLOB. The request will be sent as the POST payload in byte form. For STRING/CLOB values this will default to the UTF-8 encoding. Use the TO_BYTES function to control the byte encoding. The optional headers parameter can be used to specify the request header values as a JSON value. The JSON value should be a JSON object with primitive or list of primitive values. The procedures above give you anonymous way to execute any web service methods by supplying an endpoint, with this mechanism you can alter the endpoint defined in WSDL with a different endpoint. However, if you have access to the WSDL, then you can configure the WSDL URL in the web-service resource-adapter's connection configuration, Web Service translator can parse the WSDL and provide the methods under configured port as pre-built procedures as its metadata. If you are using Dynamic VDB's you will see the procedures in your web service's source model. Note Native queries and the direct query execution procedure are not supported on the Web Services Translator. If the stream parameter is set to true, then the resulting lob value may only be used a single time. If stream is null or false, then the engine may need to save a copy of the result for repeated use. Care must be used as some operations, such as casting or XMLPARSE may perform validation which results in the stream being consumed. The resource adapter for this translator is a Web Service Data Source. Important Currently you can only use WSDL based Procedures if they participate in WS-Security, when resource-adapter is configured with correct CXF configuration.

Commands:
<validate-on-match>true</validate-on-match>
Procedure invoke(binding in STRING, action in STRING, request in XML, endpoint in STRING) returns XML
call invoke(binding=>'HTTP', action=>'GET')
Procedure invokeHttp(action in STRING, request in OBJECT, endpoint in STRING, contentType out STRING) returns BLOB
call invokeHttp(action=>'GET')
call invokeHttp(... headers=>jsonObject('application/json' as ContentType, jsonArray('gzip', 'deflate') as "Accept-Encoding"))