The iBatis DAO with Web Services Wizard will generate a Web Service from an iBatis SQL Map. The wizard derives all of the information needed from the iBatis SQL Map to generate the following components to create a Web service:

  • DAO (Data Access Object)
  • WSDL (Web Service Definition Language)
  • XSD (XML Schema Definition)
  • Spring Configuration files

The wizard will then use the Eclipse Web Tools Platform (WTP) and Apache Axis to generate the server and client classes for the Web service. The generated classes will include code that supports Query Bands via the Teradata Access Session Manager.

 

Unknown Object

Prerequisite for this Article

If you have not worked through the guide Getting Started with Teradata Plug-in for Eclipse,do so now before you continue. You should use the single download, Eclipse IDE for Java EE Developers for your installed Eclipse. This download includes additional Eclipse packages for Web application development.


Install Server
An application server must be installed in Eclipse. Open the Web perspective in Eclipse and go to the Servers view. Right click in the view and select the New->Server drop down menu.

Select the Apache Tomcat v6.0 Server in the New Server Wizard.

 

Install the new Apache Tomcat server if required. Follow all installation instructions from Apache and Eclipse.

 

Create Teradata Project

The iBatis DAO with Web Services Wizard requires a Teradata Project. First, if you have not worked through the article Create a Teradata Project using the Teradata Plug-in for Eclipse, do so now before you continue. Now, select File->New->Other.. from the top menu bar in Eclipse. Then select the Teradata Wizards->Teradata Project from the pop-up dialog. Enter "EmployeeProject" for the name of your new Project in the Teradata Project Wizard. Once this is done select the Finish button in the Wizard and a Teradata Project will be created.

 

 

Create an iBatis SQL Map
The iBatis DAO with Web Services Wizard uses an iBatis SQL Map file to create a DAO and Web service. Create the EmployeeMapping.xml iBatis XML map using the instructions and the examples in the article Create an iBatis SQL Map with Teradata Plug-in for Eclipse.

Launch Wizard
Once you have created the EmployeeMapping.xml you can launch the iBatis DAO Web Services Wizard by right clicking on the iBatis XML file from the Package Explorer and selecting the "Create a DAO" menu option.

 

 

iBatis DAO with Web Services Wizard
The First page of the Wizard defines the new DAO and options to create a Web Service.
Select the following options:

  • Create WSDL
  • Create Web Service
  • Use Teradata Session Manager
  • Save Password

Now hit the Next button

 

 

iBatis DAO Methods
The iBatis DAO Methods Wizard Page allows you to select which SQL actions from your iBatis Map file to be used in your Web service. You can change your return type from returning a single result set object to returning a list instead. Once you hit the next button Your DAO and Web Service Definition files will be created.

 

Web Service Creation
The next page is the standard WTP Web services Wizard. Set your Client to test. Once you hit the Finish button your Stubs and Skeletons will be created for your Web Service. The Implementation stub will be modified to use the new DAO you just created.

 

Web ServiceClient
The Web Service client will come up ready to use and connected to your Teradata database.

 

 

 

Generated Code

iBatis DAO with Web Services Wizard using an iBatis XML Map has generated all of the components for your Web service application including:

  • DAO (Data Access Object) is the Java class using the iBatis XML map to call your SQL for your Web service
  • WSDL (Web Service Definition Language) is used with Apache Axis to generate the server and client classes for the Web service.
  • Schema Objects to represent the input and output parameters
  • The Server Skeleton that handles the Web service communications plumbing
  • Teradata Service class calls iBatis DAO with the Teradata Session Manager and provides a static Accessor method to the Application context.
  • Spring Configuration files which wires your Web service to your DAO
  • A Client Proxy for running the Web service

 

The Friday Night Project articles from the developer exchange describe how each generated component works individually and with each other.  It is now up to you to continue to develop your Web service application with the generated code and framework which has been provided to you.

 

Appendix A
Trouble Shooting:
You can try the following if you are having trouble bringing up your web service or test client:

Make sure you installed the following version of JEE Eclipse:

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/R/eclipse-jee-helios-win32.zip

Start your Eclipse clean (See Article below)

http://www.eclipsezone.com/eclipse/forums/t61566.html

If you are getting HTTP Status 404 in your client, try re-making the client by launching the WTP Generate Client Wizard from your WSDL file in  (Your Original Teradata Project)/WebContent/wsdl/ directory.

If you are still having problems bringing up your web service or test client, manually clean your workspace server.

  • Stop your server and clean it in Eclipse
  • Exit Eclipse
  • Erase the following file:

C:\(Your Work Space) \.metadata\.plugins\org.eclipse.wst.server.core\publish.xml

  • Erase the following folders:

C:\(Your Work Space) \.metadata\.plugins\org.eclipse.wst.server.core\publish

C:\(Your Work Space) \.metadata\.plugins\org.eclipse.wst.server.core\tmp0

  • Start Eclipse
Discussion
js185064 48 comments Joined 03/09
06 Jan 2011

You can use the iBatis DAO with Web Services Wizard to create TestNG Unit Tests for your iBatis DAO.

js185064 48 comments Joined 03/09
28 Apr 2011

I found if you increase the memory Eclipse uses by increasing the memory settings in the eclipse.ini file, the Web Services Wizard runs much better. (The more the better)

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m

js185064 48 comments Joined 03/09
29 Apr 2011

If you have a 64 bit machine, you should take advantage of it. The WTP is very memory intensive when creating a Web Service. You can increase how much memory is used with Eclipse if you install the 64 bit versions of Java, Eclipse and the Apache Tom cat server. Once you have done all this, you can increase the memory settings beyond the limitations of a 32 bit machine in your eclipse.ini file.

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
1024M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx2048m

12 May 2011

Very elaborate. Thanks!

<a href=http://www.healthinsurancepricing.com/>Best California Health Insurance</a>

js185064 48 comments Joined 03/09
18 May 2011

WSDL and JSP validation can slow down the Web Services Wizard in Eclipse. You can disable WSDL and JSP validation in Eclipse preferences if validation is slowing your system down.

Skip Carlisle 1 comment Joined 06/11
18 Jun 2011

That's a lot of research that went into this! My neighbor works for Teradata and it usually takes me a few days to realize how much more he knows than I do!

Term Life
Insurance

TeradtaUser 1 comment Joined 01/12
02 Jan 2012

How can this approach be extended to display a result set with more than one row of data? While the response can be seen using the Web Service Explorer , it is not being displayed. The following message is displayed in the result window :

Result
[empl.domain.service.schema.SqlmultilpeDomainObj1@274b6f, empl.domain.service.schema.SqlmultilpeDomainObj1@149a3, empl.domain.service.schema.SqlmultilpeDomainObj1@10211]

The actual result should display Employee No, DeptNo, Gender, Occupation, Name for three different Employees.

js185064 48 comments Joined 03/09
03 Jan 2012

The client launched by the Web Service Wizard is not a refined client. This client is for testing. It is up to you to complete your client. You can try adding a toString Method to both your client and server Employee Schema classes.
These classes are in the ....service.schema package. Add a HTML break to the String returned from your toString Method so each employee is listed on a new line from your client.

klerisson 1 comment Joined 03/11
04 Jan 2012

Good article!
Just one question regarding the enterprise JAVA application design:
What is the best way to design the data access layer to work with Teradata?
I mean, Teradata is not a common relational database even though should consider an ORM framework to work with? Or it’s better to just use a JDBC itself?

I’m facing some “entityNotFoundExceptions” in production through EJB/JPA(Hibernate)...

Regards!

js185064 48 comments Joined 03/09
04 Jan 2012

Since I wrote this article, I am going to suggest iBatis or MyBatis. The Teradata Plug-in for Eclipse provides iBatis Wizards which will create a Data Access Layer for you. The iBatis SQL Map wizard will wrap your queries into a XML iBatis Map. Then you can use the iBatis DAO with Web Services Wizard to create a Data Access Layer from your iBatis Map. The following link lists all of the iBatis Wizards with instructional articles for the Teradata Plug-in for Eclipse.

http://developer.teradata.com/tools/articles/getting-started-with-teradata-plug-in-for-eclipse

If you have specific questions about Hibernate, submit these questions to the tools forum.

Darrick S 5 comments Joined 10/09
28 Mar 2012

TERADATA USER GROUP -- WEB SERVICE DEMO

http://developer.teradata.com/services/tug-demo/Mobile.jsp

teraJava 10 comments Joined 08/12
24 Feb 2013

When launching "create a DAO" from the XML file generated, in your case EmployeeMapping.xml, I get the following Error (which is a long exception message but starts with following.) I have also tried using the "combined" wizard of creating ibatis mapping from SQL and selecting check box to launch create web service wizard which also ends up in the same message. All jars mentioned in the exception are present in my eclipse installation.

.. Teradata Datatools [main] ERROR javabean - DTS0566: Unable to parse
iBatis XML SQL map file
com.teradata.datatools.util.xml.ParseIBatisException: Error Accessing iBatis Des
criptor:mybatis.org
at com.teradata.datatools.util.xml.ParseIBatisDescriptor.getDomDoc(Parse
IBatisDescriptor.java:126) ~[com.teradata.datatools.util.db_14.1.0.201206111039.
jar:na]
at com.teradata.datatools.util.xml.ParseIBatisDescriptor.(ParseIBa
tisDescriptor.java:89) ~[com.teradata.datatools.util.db_14.1.0.201206111039.jar:
na]
at com.teradata.datatools.javabean.generate.GenerateIBatisSpringDAO.pars
eIBatisFile(GenerateIBatisSpringDAO.java:302) ~[com.teradata.datatools.javabean_
14.1.0.201206111039.jar:na]
...

js185064 48 comments Joined 03/09
25 Feb 2013

I cannot reproduce your problem. I see that you are using 14.1. You may want to upgrade to our latest 14.2 release for Teradata Plug-in for Eclipse. What release of Eclipse are you using? What JDK are you using? Did you use MyBatis or iBatis?

teraJava 10 comments Joined 08/12
25 Feb 2013

I am using eclipse 3.7.2 with JDK compliance level 1.5 and MyBatis. I generated the XML file using instructions on the generating domain objects and mapping using the teradata plugin 14.1. It semi worked for me just once when I was able to create the web services artifacts from the XML file which at the end didn't quite work well due to other axis issues. Hence I removed the whole project and started from scratch again changing nothing in the SQL or generated XML file. Is there a way to reinstall the 14.1, the 'eclipse install' link for 14.1. no longer seems to work? Is 14.2 backward compatible so it would work with UDF's and stored proc's generated using 14.1 and is eclipse 4.x a mandatory requirement for 14.2 plugin?

js185064 48 comments Joined 03/09
25 Feb 2013

We are at the next release so this is what is currently being supported. Your UDFs and Stored Procedures should work fine with 14.02. The instructions for installing the new release are in the following article:
http://developer.teradata.com/tools/articles/getting-started-with-teradata-plug-in-for-eclipse

You must sign in to leave a comment.