Skip to end of metadata
Go to start of metadata

Web Services Translator

The Web Services translator, known by the type name ws, exposes stored procedures for calling web services backed by a Teiid WS resource adapter. The WS 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 formated data.

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
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 is actually uses SOAP11, but the binding used SOAP12 you will receive execution failures.

There are no ws importer settings, 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.

Importer Properties

When specifying the importer property, it must be prefixed with "importer.". Example: importer.tableTypes

Name Description Default
importWSDL Import the metadata from the WSDL URL configured in resource-adapter true

Usage

The WS translator exposes low level procedures for accessing web services. See also the twitter example in the kit.

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's 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.

InvokeHTTP Procedure

invokeHttp can return the byte contents of an HTTP(S) 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's 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. To control the byte encoding, see the to_bytes function.

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.

Recommendations for setting headers parameter:
  • Content-Type may be necessary if HTTP POST/PUT method is invoked
  • Accept is necessary if you want to control return Media Type

WSDL based Procedures

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.

Native queries
Native queries or a direct query execution procedure is not supported on the Web Services Translator.

Streaming Considerations

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.

JCA Resource Adapter

The resource adapter for this translator is a Web Service Data Source.

WS-Secuirty
Currently you can only use WSDL based Procedures participate in WS-Security, when resource-adapter is configured with correct CXF configuration.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 21, 2014

    The two paragraphs in Streaming Considerations should probably be merged. Fixed.

  2. Sep 23, 2015

    What's the difference between
    invoke(binding=>'HTTP', action=>'GET') and invoke(binding, action)? In this occasion, no parameter used to set request xml, how request soap xml be passed to?

    I also remove prefix of procedure.

    1. Sep 24, 2015

      "Call" is not a prefix, it execution command.

      a procedure parameters can be supplied two different ways, when some of the parameters can be null/optional or have default values. When you are using

      you need to provide input values for all parameters of the procedure, and parameter positioning must match with procedure definition. when using parameter named syntax like

      you can omit the parameters where you want to use the default values, or pass in NULL. Also positioning of parameters is not significant.

      1. Sep 24, 2015

        I think only keep procedure itself should be better, for example:

        I think the 'Procedure' should be remove, the execution command 'call' as well, in my test, exec also can execute the procedure:

        1. Sep 30, 2015

          The line showing procedure ... is supposed to show the metadata representation - which we could do fully and expand to say create foreign procedure ...

          The other lines as Ramesh says show using the procedure, which can be done with the call or the exec keyword.