tag:blogger.com,1999:blog-44953786271552752282024-03-21T00:21:57.771-07:00David Hauser@BIGAnonymoushttp://www.blogger.com/profile/02774832842345794015noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-4495378627155275228.post-75652422351470369112013-06-18T16:49:00.000-07:002013-06-18T16:49:46.913-07:00Creating JBOSS Enterprise Data Services with WS-Security secured SOAP Web Services<span style="font-family: Arial, Helvetica, sans-serif;">This posting provides a concise set of technical notes on how to consume a WS Security secured SOAP Web Service with JBOSS Enterprise Data Service 5.3.1.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b><u>Steps</u></b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<ol>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Create a SOAP Web Service Data Source Connection and Generate Source & View Models</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Create a custom Password Callback Handler.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Setup the CXF Web Services configuration. </span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Create a JBOSS Data Source for the SOAP Web Service Data Source Connection.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Publish as the new Data Service View Model as a Virtual Database.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Query the new Data Service using a JDBC SQL Client.</span></li>
</ol>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b><u>Preparation</u></b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The following tools were used in this exercise:</span><br />
<br />
<ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">JBOSS Enterprise Data Services 5.3.1 (Embedded in the JBOSS SOA-P platform) – aka “JBOSS-EDS”</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">JBOSS Developer Studio 5.0 (includes the TEIID Perspective) – aka “JBDS”</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Squirrel SQL (JDBC SQL Client)</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">A WS-Security secured SOAP based Web Service using the following WS Policy: Wssp1.2-2007-Https-UsernameToken-Plain</span></li>
</ul>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">It is assumed that the reader has developed Web Service backed Data Service using JBOSS EDS and that their environment has been installed and configured appropriately.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b><u>Objective</u></b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The goal of this document is to describe how to consume a WS Security secured SOAP based Web Service with JBOSS EDS and build a Read Only Data Service on top of it. For those who are not familiar with WS Security, please review this document for an overview: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">http://en.wikipedia.org/wiki/WS-Security . </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This type of solution is required in a few Use Cases such as:</span><br />
<br />
<ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">A set of WS Security secured SOAP Web Services present an access point to Data which is needed for a Federated Data Service (that is we wish to merge it with data from another Data Source such as a Relational Database).</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">A set of WS Security secured SOAP Web Services present an access point to Data which is in a proprietary format and we wish to introduce a Canonical model to provide consistent formatting and dictionary across the Enterprise.</span></li>
</ul>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Please note that this mini-guide is not exhaustive, but aims to cover off some of the less obvious aspects of creating a JBOSS EDS Data Service for a WS Security secured SOAP Service. Many aspects of this process are already covered in the Red Hat documentation Guide for JBOSS EDS 5.3.1 : </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Data_Services/5/html-single/Teiid_Designer_User_Guide/index.html.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Now onto the details…</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #1</b>: Create a SOAP Web Service Data Source Connection and Generate Source & View Models</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">In the JBOSS EDS 5.31 / JBDS 5.0 release of the product there is no support in the GUI to create a Web Service Data Source that has WS Security in place (only support for no security or HTTP Basic). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgad652w8MJCwRgLT-wPGbkZ5xi1hMiAkd00UUJMcPp-OG-IpFZumj8LL6CI2TiaPPoQT1xHOM7R7tWiuPfbEXUzNlfKTMM8a5AQvA4kluj1TIMJ4cjI7J1Yyexngm_lWcZpFma6d4A-J4/s1600/createNewSoapDsConnection.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgad652w8MJCwRgLT-wPGbkZ5xi1hMiAkd00UUJMcPp-OG-IpFZumj8LL6CI2TiaPPoQT1xHOM7R7tWiuPfbEXUzNlfKTMM8a5AQvA4kluj1TIMJ4cjI7J1Yyexngm_lWcZpFma6d4A-J4/s640/createNewSoapDsConnection.png" width="640" /></a></span></div>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The work around for this is to create a connection using the “None” Security Type. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Once created, use the “import” feature on the JBDS menu from your project to import a SOAP Web Service for Source and View Models.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">With the Source and View Models created, be sure to use the connection that was earlier prepared. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b><u>Hint</u></b>: Make sure that the URL from the SOAP WSDL is in alignment with the Host certificate if the SOAP URL uses HTTPS. This can be done by opening the Source Model of the SOAP Service using an XML Editor and updating the PORT reference to use a Fully Qualified Domain Name that lines up with the SSL Cert that the host has installed ( it is in a configuration called key="connection:EndPoint").</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #2</b>: Create a customer Password Callback Handler</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">In order to handle the “credential” (password) side of the authentication with a WS Security policy that implements a Username Toke scheme, one common approach is to provide a password. The password in this example is a static string that is stored in a Java Class. This is by no means a best practice and should not be considered final for a Production Deployment. More realistic options would include re-implementing the provided class to better secure the password at rest. The following source was provided by the JBOSS EDS team as an example only:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>UsernamePasswordCallback.java</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">package org.teiid.soap.wsse;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
import java.io.IOException;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
import javax.security.auth.callback.Callback;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.security.auth.callback.CallbackHandler;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.security.auth.callback.UnsupportedCallbackException;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import org.apache.ws.security.WSPasswordCallback;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
public class UsernamePasswordCallback implements CallbackHandler {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * This class should be updated to use implementation specific</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * authentication. it is not recommended to use for production as-is.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @see</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * javax.security.auth.callback.CallbackHandler#handle(javax.security.auth</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * .callback.Callback[])</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> */</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void handle(Callback[] callbacks) throws IOException,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>UnsupportedCallbackException {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < callbacks.length; i++) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (callbacks[i] instanceof WSPasswordCallback) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ("myUsername".equals(pc</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>.getIdentifier())) {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>pc.setPassword("user01");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>throw new UnsupportedCallbackException(callbacks[i],</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>"unrecognized_callback"); //$NON-NLS-1$</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #3</b>: Setup the CXF Web Services configuration</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This is the least well documented step. In the JBOSS SOA-P installation, find the “Active Deployment” that you are using. For example, the setup used for this mini-guide is as follows:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">C:\software\jboss-soa-p-5\jboss-as\server\default</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Below this directory there are 2 relevant sub-directories: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">deploy – where all the WAR files, Data Source Files (*-ds.xml), EAR files and other deployments go</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">conf – where some key configuration files are kept</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Inside the conf sub-directory create an XML file with the following settings:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>WS-ABC-CONFIG.xml</b></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><beans xmlns="http://www.springframework.org/schema/beans"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> http://cxf.apache.org/schemas/configuration/http-conf.xsd</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> http://www.springframework.org/schema/beans</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> http://www.springframework.org/schema/beans/spring-beans.xsd</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> http://cxf.apache.org/jaxws</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> http://cxf.apache.org/schemas/jaxws.xsd"></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><jaxws:client name="{http://teiid.org}SOAP-SERVICE-ABC"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>createdFromAPI="true"></span><br />
<span class="Apple-tab-span" style="font-family: Courier New, Courier, monospace; font-size: x-small; white-space: pre;"> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><jaxws:outInterceptors></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><ref bean="Timestamp_Request" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></jaxws:outInterceptors></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><jaxws:features></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><bean class="org.apache.cxf.feature.LoggingFeature" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></jaxws:features></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></jaxws:client></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>id="Timestamp_Request"></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><constructor-arg></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><map></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><entry key="action" value="UsernameToken" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><entry key="passwordType" value="PasswordText" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><entry key="user" value="myUsername" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><entry key="passwordCallbackRef" value-ref="myPasswordCallback" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></map></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></constructor-arg></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></bean></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><bean id="myPasswordCallback" class="org.teiid.soap.wsse.UsernamePasswordCallback" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><http-conf:conduit name="*.http-conduit"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>xmlns:sec="http://cxf.apache.org/configuration/security" xmlns="http://cxf.apache.org/transports/http/configuration"></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><http-conf:tlsClientParameters</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>disableCNCheck="true" useHttpsURLConnectionDefaultHostnameVerifier="false" /></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></http-conf:conduit></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br />
</beans></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The key items to configure for your environment include the following:</span><br />
<br />
<ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor" – set the SOAP Username here under the ‘user’ key; Also set the reference to the Password callback class here under the ‘passwordCallbackRef’ key. </span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">disableCNCheck – set this up if you are having challenges with HTTPS and certificates on Pre-PRODUCTION environments.</span></li>
</ul>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #4:</b> Create a JBOSS Data Source for the SOAP Web Service Data Source Connection</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Next create a JBOSS Application Server data service for the SOAP Web Service. This config goes in the active deployment ‘deploy’ sub-directory. This is where the CXF config file is referenced to ensure that the security is configured.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><b>MyDataSource-ds.xml</b></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><?xml version="1.0" encoding="UTF-8" standalone="yes"?></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><connection-factories></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <no-tx-connection-factory></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <jndi-name>MyDataSource</jndi-name></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <rar-name>teiid-connector-ws.rar</rar-name></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <use-java-context>true</use-java-context></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <min-pool-size>0</min-pool-size></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <max-pool-size>10</max-pool-size></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <blocking-timeout-millis>3000</blocking-timeout-millis></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <idle-timeout-minutes>31</idle-timeout-minutes></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <prefill>false</prefill></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <background-validation>false</background-validation></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <background-validation-millis>0</background-validation-millis></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <validate-on-match>true</validate-on-match></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <use-fast-fail>false</use-fast-fail></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <isSameRM-override-value>false</isSameRM-override-value></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <allocation-retry>0</allocation-retry></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <allocation-retry-wait-millis>5000</allocation-retry-wait-millis></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <config-property type="java.lang.String" name="EndPoint">https://VM-EAP-DS-DEV01:8002/ItemMaster_v4-context-root/ItemMasterImplPort</config-property></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <config-property type="java.lang.String" name="SecurityType">WSSecurity</config-property></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <config-property type="java.lang.String" name="template-name">connector-ws</config-property></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <config-property name="ConfigFile">${jboss.server.home.dir}/conf/WS-ABC-CONFIG.xml</config-property></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <config-property type="java.lang.String" name="ConfigName">JDE-World-SE</config-property></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </no-tx-connection-factory></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></connection-factories></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The properties that are important to configure here include:</span><br />
<br />
<ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">JNDI Name – this goes into the JBOSS AS runtime and is how the JBOSS EDS Virtual Database refers to the underlying SOAP connection. Since this is generated to some degree, you may have to take what the VDB Editor shows and use it to over-ride the value in this property.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">End Point – ensure this is the correct URL using the same name as the SSL Certificate and your corporate DNS server. If the WSDL uses internally IPs (i.e. 192.168.1.x or 127.0.0.1) there might be challenges depending on deployment configurations into Production.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">ConfigFile – this is the reference to the CXF xml config file we looked at in step 4 above. This is an absolute path to the file.</span></li>
</ul>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #5</b>: Publish as the new Data Service View Model as a Virtual Database</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The next step is to create a new Virtual Database in the JBDS tool with the Teiid Perspective. Add in the Source and View Models. Check that the JNDI name which references the Data Source which was configured in Step 5 is correct. If not, just edit the value in the Data Source (*-ds.xml) file since the VDB does not allow this to be changed.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Step #6</b>: Query the new Data Service using a JDBC SQL Client</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Finally, deploy the VDB to the JBOSS EDS runtime and test the new Data Service with a standalone JDBC SQL Client. Squirrel SQL provides one option for this task. Add the Teiid-client.jar as the JDBC driver, and add a new Alias for the connection:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Example JDBC Alias for a Teiid VDB</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">jdbc:teiid:MyVDB@mm://localhost:31000;ApplicationName=squirrelSqlDmh</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Once connected, try the Data Service with a SQL Query. An example query can be generated from the JBDS “Scrapbook” View. A sample might look something like:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">select * from (exec "MySoapServiceView"."getSomething"('aParameter')) as X_X</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">And that concludes this mini-guide. Much of the related work is well documented in the product documentation which can be found at the start of this document.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">It is recommended that a new Teiid Developer work through an end to end example with an unsecured SOAP Web Service prior to trying to consume a WS Security secured Web Service.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">For and questions or suggestions please post to this blog.</span><br />
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/02774832842345794015noreply@blogger.com1