You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Oded Onn <Od...@mobixell.com> on 2010/01/10 12:02:10 UTC

Axis2: Deploying a service to a Tomcat server

Hi there,

 

I am quite new to the world of WS and Axis 2 and am sorry if my
questions seems a bit silly. However, I looked for answers in your
forums and documentation and didn't find them.

 

I wrote my first WS using Axis2. Started from a WSDL file and generated
the server code. Now, as far as I understand from your manual, I am
suppose to do the following:

1.       Write the business logic (in the MyServiceSkeleton.java file)

2.       Build the WS

3.       Copy the generated AAR file into the services directory of my
axis2 server

4.       Create the axis2.WAR file using "ant create.war"

5.       Copy thr genearetd axis2.WAR from the dist directory into my
tomcat server webapp directory.

 

I followed the above steps and it works (I tested my service with SOAPUI
as the client). 

I have some questions: 

1.       Is there an easier way to do the above steps in a production
environment? Can I somehow generate the war file to be used in tomcat in
a simpler way? At the moment, every time I change the business logic I
have to redo all these steps...

2.       Can I deploy the service without the "axis2/services/" prefix
in the URL? The service is to be deployed to a client, and thus I prefer
it to have a "clean" URL. At the moment it is
"http://localhost:8080/axis2/services/MyService". Can I deploy it to be
"http://localhost:8080/MyService"?

3.       I noticed that there is no complete validation of the SOAP
request (i.e. no check that the XML passed is correct according to the
schema described in the WSDL). Where should I add this kind of
validation? Is there any automatic methods that I need to call? I assume
the answer is somewhere in the "MyServiceMessageReceiverInOut.java file"
- I am just really not sure how to approach this file. I read some about
handlers - is this the right way to perform validation?

 

Thank you very much for your help - it is much appreciated!

Best,

Oded

 

Oded.Onn@mobixell.com


RE: Axis2: Deploying a service to a Tomcat server

Posted by Oded Onn <Od...@mobixell.com>.
Thank you Deepal,

I am still not sure about the following issues:

1. Let's say I already generated the axis2.war file once (with my service). Afterwards I changed my business logic. As far as I understand from your answer, I can now somehow deploy my service.aar to tomcat, without rebuilding the axis2.war (ant create.war after my service.aar is in repository/services dir). Can you explain in a bit more details how can I do that? Do you mean adding it to the axis2.war file? Is there a way with axis2 to deploy my service as a regular war file?

2. I would appreciate it if you can send me a pointer to a WS with schema validation (handler) that uses jaxb (or similar tech) to validate client requests. I didn't find any example in the axis2 documentation for this kind of validation. It seems to me that this should be a common issue with WS (server provider side).

3. I encountered a problem with the class loading (or at least I think so). I am using jdk1.5 and tomcat5.5. I generate the server side only. As far as I understand the axis2.war should contain under the services dir the available services (aar files). Now, when building the aar, I am adding external jars that I am using into the aar /lib dir. It looks as follows:

myservice.aar:
lib/
	XBeans-packaged.jar
	my-external.jar

axis2.war:
WEB-INF/services/myservice.aar

Should the external jar(s) also reside in WEB-INF/lib/ ?

At the moment, I am getting 'java.lang.NoClassDefFoundError' exceptions, although I believe I have all the necessary jars under the lib/ of the aar file. I also copied the jars to the lib/ folder of the axis2 deployed war (in tomcat) but to no avail. When debugging it remote with IntelliJ it tells me: 'Class not loaded:com.xxx'. 

Any thought?

Thanks!
Oded


-----Original Message-----
From: Deepal Jayasinghe [mailto:deepal@opensource.lk] 
Sent: Sunday, January 10, 2010 17:42
To: axis-user@ws.apache.org
Subject: Re: Axis2: Deploying a service to a Tomcat server



Oded Onn wrote:
>
> Hi there,
>
>  
>
> I am quite new to the world of WS and Axis 2 and am sorry if my
> questions seems a bit silly. However, I looked for answers in your
> forums and documentation and didn’t find them.
>
>  
>
> I wrote my first WS using Axis2. Started from a WSDL file and
> generated the server code. Now, as far as I understand from your
> manual, I am suppose to do the following:
>
> 1.       Write the business logic (in the MyServiceSkeleton.java file)
>
> 2.       Build the WS
>
> 3.       Copy the generated AAR file into the services directory of my
> axis2 server
>
> 4.       Create the axis2.WAR file using “ant create.war”
>
You do not need to generate the war, download it and deploy to tomcat.
Then you can deploy your service there.
>
> 5.       Copy thr genearetd axis2.WAR from the dist directory into my
> tomcat server webapp directory.
>
>  
>
> I followed the above steps and it works (I tested my service with
> SOAPUI as the client).
>
> I have some questions:
>
> 1.       Is there an easier way to do the above steps in a production
> environment? Can I somehow generate the war file to be used in tomcat
> in a simpler way? At the moment, every time I change the business
> logic I have to redo all these steps…
>
You do not need, just replace the aar file.
>
> 2.       Can I deploy the service without the “axis2/services/” prefix
> in the URL? The service is to be deployed to a client, and thus I
> prefer it to have a “clean” URL. At the moment it is
> “http://localhost:8080/axis2/services/MyService”. Can I deploy it to
> be “http://localhost:8080/MyService”?
>
Yes you can, for that you need to edit axis2.xml in
webapps/axis2/WEB-INF/conf

there is a parameter called context path.
>
> 3.       I noticed that there is no complete validation of the SOAP
> request (i.e. no check that the XML passed is correct according to the
> schema described in the WSDL). Where should I add this kind of
> validation? Is there any automatic methods that I need to call? I
> assume the answer is somewhere in the
> “MyServiceMessageReceiverInOut.java file” – I am just really not sure
> how to approach this file. I read some about handlers – is this the
> right way to perform validation?
>
Axis2 does not do that because it adds additional cost. But you can
write your own handler and do the validation.

Thanks,
Deepal
>
>  
>
> Thank you very much for your help – it is much appreciated!
>
> Best,
>
> Oded
>
>  
>
> Oded.Onn@mobixell.com
>

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org


Re: Axis2: Deploying a service to a Tomcat server

Posted by Deepal Jayasinghe <de...@opensource.lk>.

Oded Onn wrote:
>
> Hi there,
>
>  
>
> I am quite new to the world of WS and Axis 2 and am sorry if my
> questions seems a bit silly. However, I looked for answers in your
> forums and documentation and didn’t find them.
>
>  
>
> I wrote my first WS using Axis2. Started from a WSDL file and
> generated the server code. Now, as far as I understand from your
> manual, I am suppose to do the following:
>
> 1.       Write the business logic (in the MyServiceSkeleton.java file)
>
> 2.       Build the WS
>
> 3.       Copy the generated AAR file into the services directory of my
> axis2 server
>
> 4.       Create the axis2.WAR file using “ant create.war”
>
You do not need to generate the war, download it and deploy to tomcat.
Then you can deploy your service there.
>
> 5.       Copy thr genearetd axis2.WAR from the dist directory into my
> tomcat server webapp directory.
>
>  
>
> I followed the above steps and it works (I tested my service with
> SOAPUI as the client).
>
> I have some questions:
>
> 1.       Is there an easier way to do the above steps in a production
> environment? Can I somehow generate the war file to be used in tomcat
> in a simpler way? At the moment, every time I change the business
> logic I have to redo all these steps…
>
You do not need, just replace the aar file.
>
> 2.       Can I deploy the service without the “axis2/services/” prefix
> in the URL? The service is to be deployed to a client, and thus I
> prefer it to have a “clean” URL. At the moment it is
> “http://localhost:8080/axis2/services/MyService”. Can I deploy it to
> be “http://localhost:8080/MyService”?
>
Yes you can, for that you need to edit axis2.xml in
webapps/axis2/WEB-INF/conf

there is a parameter called context path.
>
> 3.       I noticed that there is no complete validation of the SOAP
> request (i.e. no check that the XML passed is correct according to the
> schema described in the WSDL). Where should I add this kind of
> validation? Is there any automatic methods that I need to call? I
> assume the answer is somewhere in the
> “MyServiceMessageReceiverInOut.java file” – I am just really not sure
> how to approach this file. I read some about handlers – is this the
> right way to perform validation?
>
Axis2 does not do that because it adds additional cost. But you can
write your own handler and do the validation.

Thanks,
Deepal
>
>  
>
> Thank you very much for your help – it is much appreciated!
>
> Best,
>
> Oded
>
>  
>
> Oded.Onn@mobixell.com
>

-- 
Thank you!


http://blogs.deepal.org
http://deepal.org