<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Web+Services+Translator">Web Services Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~kylin">Kylin Soong</a>
    </h4>
        <br/>
                         <h4>Changes (9)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>Invoke allows for multiple binding, or protocol modes, including HTTP, SOAP11, and SOAP12. <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">{code}<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">Procedure </span>invoke(binding</span> in STRING, action in STRING, request in XML, endpoint in STRING, stream in BOOLEAN) returns XML{code} <br></td></tr>
            <tr><td class="diff-unchanged" >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. <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax. <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}call invoke(binding=&gt;&#39;HTTP&#39;, action=&gt;&#39;GET&#39;){code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code}invoke(binding=&gt;&#39;HTTP&#39;, action=&gt;&#39;GET&#39;){code} <br></td></tr>
            <tr><td class="diff-unchanged" >The request XML should be a valid XML document or root element. <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{{invokeHttp}}&amp;nbsp;can return the byte contents of an HTTP(S) call. <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">{code}<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">Procedure </span>invokeHttp(action</span> in STRING, request in OBJECT, endpoint in STRING, stream in BOOLEAN, contentType out STRING, headers in CLOB) returns BLOB{code} <br></td></tr>
            <tr><td class="diff-unchanged" >Action indicates the HTTP method (GET, POST, etc.), which defaults to POST. <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax. <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}call invokeHttp(action=&gt;&#39;GET&#39;){code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{code}invokeHttp(action=&gt;&#39;GET&#39;){code} <br></td></tr>
            <tr><td class="diff-unchanged" >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. <br> <br>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. <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">{code}<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">call </span>invokeHttp(...</span> headers=&gt;jsonObject(&#39;application/json&#39; as ContentType, jsonArray(&#39;gzip&#39;, &#39;deflate&#39;) as &quot;Accept-Encoding&quot;)){code} <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. *WSDL based Procedures* <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">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&#39;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&#39;s you will see the procedures in your web service&#39;s source model.  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">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&#39;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&#39;s you will see the procedures in your web service&#39;s source model. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{info:title=Native queries} <br>Native queries or a direct query execution procedure is not supported on the Web Services Translator.{info} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="WebServicesTranslator-WebServicesTranslator"></a><b>Web Services Translator</b></h1>

<p>The Web Services translator, known by the type name&nbsp;<em>ws</em>, 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.&nbsp; Results from this translator will commonly be used with the TEXTTABLE or XMLTABLE table functions to use CSV or XML formated data.</p>

<p><b>Execution Properties</b>&nbsp;</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> When Used <br class="atl-forced-newline" /> </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> DefaultBinding </td>
<td class='confluenceTd'> The binding that should be used if one is not specified. Can be one of HTTP, SOAP11, or SOAP12 </td>
<td class='confluenceTd'> invoke&#42; <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> SOAP12 </td>
</tr>
<tr>
<td class='confluenceTd'> DefaultServiceMode </td>
<td class='confluenceTd'> 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 </td>
<td class='confluenceTd'> invoke&#42; or WSDL call <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> PAYLOAD </td>
</tr>
<tr>
<td class='confluenceTd'> XMLParamName </td>
<td class='confluenceTd'> Used with the HTTP binding (typically with the GET method) to indicate that the request document should be part of the query string. </td>
<td class='confluenceTd'> invoke&#42; <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> null - unused </td>
</tr>
</tbody></table>
</div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>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.</td></tr></table></div>
<p>There are no ws importer settings, but it does provide metadata for dynamic VDBs.&nbsp; 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.</p>

<h3><a name="WebServicesTranslator-Usage"></a><b>Usage</b></h3>

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

<h3><a name="WebServicesTranslator-InvokeProcedure"></a><b>Invoke Procedure</b></h3>

<p>Invoke allows for multiple binding, or protocol modes, including HTTP, SOAP11, and SOAP12.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">invoke(binding in STRING, action in STRING, request in XML, endpoint in STRING, stream in BOOLEAN) returns XML</pre>
</div></div>
<p>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.</p>

<p>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.</p>

<p>Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">invoke(binding=&gt;'HTTP', action=&gt;'GET')</pre>
</div></div>
<p>The request XML should be a valid XML document or root element.</p>

<h3><a name="WebServicesTranslator-InvokeHTTPProcedure"></a><b>InvokeHTTP Procedure</b></h3>

<p><tt>invokeHttp</tt>&nbsp;can return the byte contents of an HTTP(S) call.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">invokeHttp(action in STRING, request in OBJECT, endpoint in STRING, stream in BOOLEAN, contentType out STRING, headers in CLOB) returns BLOB</pre>
</div></div>
<p>Action indicates the HTTP method (GET, POST, etc.), which defaults to POST.</p>

<p>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.</p>

<p>Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">invokeHttp(action=&gt;'GET')</pre>
</div></div>
<p>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.</p>

<p>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.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">invokeHttp(... headers=&gt;jsonObject('application/json' as ContentType, jsonArray('gzip', 'deflate') as "Accept-Encoding"))</pre>
</div></div>

<h3><a name="WebServicesTranslator-WSDLbasedProcedures"></a><b>WSDL based Procedures</b></h3>

<p>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.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Native queries</b><br />Native queries or a direct query execution procedure is not supported on the Web Services Translator.</td></tr></table></div>

<h3><a name="WebServicesTranslator-StreamingConsiderations"></a><b>Streaming Considerations</b></h3>

<p>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.</p>

<h3><a name="WebServicesTranslator-JCAResourceAdapter"></a><b>JCA Resource Adapter</b></h3>

<p>The resource adapter for this translator is a <a href="/author/display/TEIID/Web+Service+Data+Sources" title="Web Service Data Sources">Web Service Data Source</a>.</p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>WS-Secuirty</b><br />Currently you can only use WSDL based Procedures participate in WS-Security, when resource-adapter is configured with correct CXF configuration.</td></tr></table></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Web+Services+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477042&revisedVersion=7&originalVersion=6">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Web+Services+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>