You are welcome!

-- dims

On 8/8/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

Preface
I have a simple application which does nothing more than Insert, Update,
Delete, Select from the Oracle database.
Its a J2EE application where

Front End : Struts 1.2, JSP etc.

Middle Layer - Business Delegates, Service Locator, Value objects etc.

Data Access Layer - iBATIS

The application is deployed in Tomcat 5 and I use myeclipse to build my
applications.

My Requirement - Axis2 comes into play

My new requirement is to build a web services layer on top of this
application. So that all those magic Selects, Inserts, Updates and Deletes
can be done via other interfaces.
Hence I chose to use Axis2 to accomplish the task.

My attempt

I am new to Axis2 and web services.

I wanted to use a select, and write a simple servlet to invoke this web
service. This is what I did.

1. I had wrote the wsdl file manually.

2. I am using the nightly build of 08/07/2006. I am seeing some email about
broken build. But I am not facing any problem.
        - First doubt was, which jars to use, one from bin-min or bin-std. I
decided to use the 24 jars inside bin-min.

3. First mistake done and a major one. Do not use the eclipse plug-in tool
for code generation. Use the commandline tool that is packaged inside the
nightly build. Thanks Dims for the information (don't know how many times I
am going to thank this guy)

4. Update the My*Skeleton code to call my delegate which in turn calls the
iBATIS layer (my DAO classes) to get the information from the database.
Convert the object to one for the return type.

5. I export the java project from eclipse as a jar file and rename it to
.aar. Short, simple and works for dev purposes. Next mistake made here -
Never put the axis2 distribution jar files inside the .aar file. Put them in
the WEB-INF/lib. This is also identified and prompted by Dims. Thanks again.

6. So now, where do I put my iBATIS jars and log4j jars (there could be
more). Create a directory "lib" inside the .aar and place them inside it.
Basically I created a folder "lib" at the root of my eclipse java project
and placed all these jars in there.

7. Now deploy this .aar in Axis2. Check out the services to confirm all is
golden.

8. Now I took the same wsdl file as if I am a client and have no whereabouts
of the webservice. Now I want to write a servlet in my webapp, one in my
world, who knows nothing of the above. First I generated only the client
code using the WSDL2Java commandline tool and this wsdl file. Yes, I am
writing an axis2 client. This created just one My*Stub.java. All other
required classes are created as inner classes. How can I make the tool
create separate java files rather than all these inner classes?

9. Now from the servlet I call this stub and the method and hope to get a
response. This took me 2 days and I could have done nothing without Dims who
removed the major road blocks (you were great! Thanks again!!!).

10. When you are returning an object, then make sure to populate all the
fields of the object. I was asking Dims, whether there is any default rule
in Axis2. Well, I think we should take care of this in the middle layer
business logic, and the onus should not be on Axis2.

11. In my application, I had all my iBATIS and other config xml and
properties under a xml folder and they were placed in the .aar accordingly.
But the regular release has a classpath issue because of which it fails to
find and load the properties. This was also pointed out by Dims and he fixed
it and was available in the nightly build. Thanks again.

12. So, make sure you are using the nightly build if you have a similar
structure as mine, Make sure you run the wsdl2java again (don't mix and
match old generated code with new jars or vice versa).
 Make sure you thoroughly check all the jars that are in your environment.
It's very easy to mix jars and not know about it - These are all words from
Dims, I am putting it here again. Thanks!.

Hope it helps and again big thanks for the apache group and especially Dims.

Thanks
Debasish

 ___________________________________________________
 Debasish Dutta Roy
 NITAS
 Ph: 617-871-3033

 _________________________

 CONFIDENTIALITY NOTICE

 The information contained in this e-mail message is intended only for the
exclusive use of the individual or entity named above and may contain
information that is privileged, confidential or exempt from disclosure under
applicable law. If the reader of this message is not the intended recipient,
or the employee or agent responsible for delivery of the message to the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by e-mail and delete the material from any computer.  Thank you.



--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to