Re: can I package handlers in the .aar archive instead of a separate module?
Can I package both aar and mar in the same ear file and deploy it to an app server, say geronimo? Or maybe even include axis2.war in the same ear? I am trying to have a self-contained archive. Deepal Jayasinghe-2 wrote: > > olegf wrote: >> I would like to define custom user handlers and invoke them per >> operation. Is >> there way to define them in services.xml and package them in the same >> .aar >> file as the services? I don't want to package them in a separate module >> archive or include them in the system class path, as then I would have to >> package everything that goes with it. >> Basically, I am just trying to find a way to define custom phases without >> overriding the axis2.xml or splitting the application across services >> archive and modules archive and having separate deployments. >> > We had support for having handlers in the aar file, but we do not have > it. So only way is to have a separate mar and engage that to the > operations you want. > > Deepal >> Has anyone tried that with axis2? >> Thanks in advance. >> > > > -- > Thank you! > > > http://blogs.deepal.org > http://deepal.org > > > -- View this message in context: http://www.nabble.com/can-I-package-handlers-in-the-.aar-archive-instead-of-a-separate-module--tp24099634p24105034.html Sent from the Axis - User mailing list archive at Nabble.com.
Re: can I package handlers in the .aar archive instead of a separate module?
olegf wrote: > I would like to define custom user handlers and invoke them per operation. Is > there way to define them in services.xml and package them in the same .aar > file as the services? I don't want to package them in a separate module > archive or include them in the system class path, as then I would have to > package everything that goes with it. > Basically, I am just trying to find a way to define custom phases without > overriding the axis2.xml or splitting the application across services > archive and modules archive and having separate deployments. > We had support for having handlers in the aar file, but we do not have it. So only way is to have a separate mar and engage that to the operations you want. Deepal > Has anyone tried that with axis2? > Thanks in advance. > -- Thank you! http://blogs.deepal.org http://deepal.org
Re: Problem with Runtime.getRuntime() exec
The way to set up environment variables for Tomcat depends on how you start Tomcat. If you use the standard Ubuntu package, probably the best way is to add the following line to /etc/default/tomcatX.X: export ENV_VARIABLE=... Note that (on Linux) /etc/environment is only read by pam_env during interactive logins. This means that variables defined there will not be available to processes started by the SysV init scripts. Andreas On Fri, Jun 19, 2009 at 00:22, artifex wrote: > > Thank you, Andreas > I've checked environ: > sudo netstat -anp | grep 8080 // got PID by this comand > sudo cat /proc//environ > The ouput is the same as I received by the webservice (...that snippet, > which prints all env variables). So it's just another way to check(not to > add or edit) what env variables are avaliable in runtime for your > webservice, but the problem isn't solved...still the same question: > > ***How to set up your own environment variable, which you would like > to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web > service ?*** > > Thanks for help > > > Andreas Veithen-2 wrote: >> >> If System.getenv returns null, then this means that the environment >> variable is not set on the process. This has nothing to do with class >> loaders or the fact that you look up the variable from within a >> service. You can check that by looking at /proc//environ, where >> is Tomcat's process ID. >> >> Andreas >> >> On Thu, Jun 18, 2009 at 18:38, artifex wrote: >>> >>> Things in use: >>> Ubuntu 9.04 (jaunty) >>> Tomcat 6 (deb package) >>> Axis2 >>> Maven >>> Eclipse >>> other >>> >>> >>> There is some other information: >>> System.getenv("ENV_VARIABLE") will return null in this case, because the >>> variable doesn't exist. >>> if we run this snippet inside some class, which is part of our web >>> service: >>> >>> Map map = System.getenv(); >>> Set keys = map.keySet(); >>> Iterator iterator = keys.iterator(); >>> while (iterator.hasNext()) { >>> String key = (String) iterator.next(); >>> String value = (String) map.get(key); >>> System.out.println(key + " = " + value); >>> >>> --- we will get a list of environment variables and this list is >>> different >>> from that you get in command line : env >>> (I'm using Ubuntu) >>> >>> Even if I set up my own env variable under root(for example like this: >>> >>> sudo gedit /etc/environment >>> ENV_VARIABLE=/home/user/some_folder //put this line in /etc/environment >>> and >>> save then reboot >>> ) --- then rebuild and redeploy service(just in case) which contains >>> class >>> with above snippet, I cannot see ENV_VARIABLE in output of tomcat >>> console >>> (catalina.sh run) >>> >>> So now the question is : >>> >>> ***How to set up your own environment variable, which you would >>> like >>> to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web >>> service ?*** >>> >>> >>> Deepal Jayasinghe wrote: Hmm, I am not so sure that has something to do with the class loader, if that is the case then problem might be due to each service has its own class loader and it is different from context class loader. Anyway as I remember correct no one asked this kind of question before, so if you find that answer please post that too. Thanks, Deepal artifex wrote: > That thing didn't work because it couldn't find path to the desired > program > for execution. > I'm using environment variables in my java code("String envV = > System.getenv("ENV_VARIABLE");"), but it seems that getenv() cannot > find > the variable. I'm sure it's set up correctly. So now my goal is to find > out > how we can get environmental variables if classes which try to get it > are > inside a web service(???)... > > ...if anyone knows please give me a hint... > > > artifex wrote: > >> I have deployed a webservice using Axis2. It works fine, but >> Here is a problem: I need to run an external program through the >> Client, >> so I've put in existing library piece of code, which contains >> Runtime.getRuntime(). When I run test, it works fine, but no external >> program is run. It seems like piece of code with "Runtime rt = >> Runtime.getRuntime();"(it works when is run locally) just ignored... >> Could anyone help me with this issue? >> >> This is class to be wrapped : >> package eu.project.samplewebservice; >> >> >> >> import java.io.BufferedReader; >> >> import java.io.InputStream; >> >> import java.io.InputStreamReader; >> >> >> >> >> public class SampleExistingLibrary { >> >> >> >> /** >> >> * Adds two input integer parameters and returns the result. >> >> * >> >> * @param i1 >> >> * An integer input >>
Re: Problem with Runtime.getRuntime() exec
Thank you, Andreas I've checked environ: sudo netstat -anp | grep 8080 // got PID by this comand sudo cat /proc//environ The ouput is the same as I received by the webservice (...that snippet, which prints all env variables). So it's just another way to check(not to add or edit) what env variables are avaliable in runtime for your webservice, but the problem isn't solved...still the same question: ***How to set up your own environment variable, which you would like to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web service ?*** Thanks for help Andreas Veithen-2 wrote: > > If System.getenv returns null, then this means that the environment > variable is not set on the process. This has nothing to do with class > loaders or the fact that you look up the variable from within a > service. You can check that by looking at /proc//environ, where > is Tomcat's process ID. > > Andreas > > On Thu, Jun 18, 2009 at 18:38, artifex wrote: >> >> Things in use: >> Ubuntu 9.04 (jaunty) >> Tomcat 6 (deb package) >> Axis2 >> Maven >> Eclipse >> other >> >> >> There is some other information: >> System.getenv("ENV_VARIABLE") will return null in this case, because the >> variable doesn't exist. >> if we run this snippet inside some class, which is part of our web >> service: >> >> Map map = System.getenv(); >> Set keys = map.keySet(); >> Iterator iterator = keys.iterator(); >> while (iterator.hasNext()) { >> String key = (String) iterator.next(); >> String value = (String) map.get(key); >> System.out.println(key + " = " + value); >> >> --- we will get a list of environment variables and this list is >> different >> from that you get in command line : env >> (I'm using Ubuntu) >> >> Even if I set up my own env variable under root(for example like this: >> >> sudo gedit /etc/environment >> ENV_VARIABLE=/home/user/some_folder //put this line in /etc/environment >> and >> save then reboot >> ) --- then rebuild and redeploy service(just in case) which contains >> class >> with above snippet, I cannot see ENV_VARIABLE in output of tomcat >> console >> (catalina.sh run) >> >> So now the question is : >> >> ***How to set up your own environment variable, which you would >> like >> to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web >> service ?*** >> >> >> Deepal Jayasinghe wrote: >>> >>> Hmm, I am not so sure that has something to do with the class loader, if >>> that is the case then problem might be due to each service has its own >>> class loader and it is different from context class loader. Anyway as I >>> remember correct no one asked this kind of question before, so if you >>> find that answer please post that too. >>> >>> Thanks, >>> Deepal >>> >>> artifex wrote: That thing didn't work because it couldn't find path to the desired program for execution. I'm using environment variables in my java code("String envV = System.getenv("ENV_VARIABLE");"), but it seems that getenv() cannot find the variable. I'm sure it's set up correctly. So now my goal is to find out how we can get environmental variables if classes which try to get it are inside a web service(???)... ...if anyone knows please give me a hint... artifex wrote: > I have deployed a webservice using Axis2. It works fine, but > Here is a problem: I need to run an external program through the > Client, > so I've put in existing library piece of code, which contains > Runtime.getRuntime(). When I run test, it works fine, but no external > program is run. It seems like piece of code with "Runtime rt = > Runtime.getRuntime();"(it works when is run locally) just ignored... > Could anyone help me with this issue? > > This is class to be wrapped : > package eu.project.samplewebservice; > > > > import java.io.BufferedReader; > > import java.io.InputStream; > > import java.io.InputStreamReader; > > > > > public class SampleExistingLibrary { > > > > /** > > * Adds two input integer parameters and returns the result. > > * > > * @param i1 > > * An integer input > > * @param i2 > > * An integer input > > * @return The integer result which is the sum of the two input > integers > > */ > > public int addTwoIntegers( int i1, int i2 ) { > > System.out.println( "TEST!!" ); > > ///!!! > > String mkcolpath = System.getenv("MKCOLPATH"); > > String pafpath = System.getenv("PAFPATH"); > > //System.out.print(mkcolpath); > > try > > { >
can I package handlers in the .aar archive instead of a separate module?
I would like to define custom user handlers and invoke them per operation. Is there way to define them in services.xml and package them in the same .aar file as the services? I don't want to package them in a separate module archive or include them in the system class path, as then I would have to package everything that goes with it. Basically, I am just trying to find a way to define custom phases without overriding the axis2.xml or splitting the application across services archive and modules archive and having separate deployments. Has anyone tried that with axis2? Thanks in advance. -- View this message in context: http://www.nabble.com/can-I-package-handlers-in-the-.aar-archive-instead-of-a-separate-module--tp24099634p24099634.html Sent from the Axis - User mailing list archive at Nabble.com.
Re: Problem with Runtime.getRuntime() exec
If System.getenv returns null, then this means that the environment variable is not set on the process. This has nothing to do with class loaders or the fact that you look up the variable from within a service. You can check that by looking at /proc//environ, where is Tomcat's process ID. Andreas On Thu, Jun 18, 2009 at 18:38, artifex wrote: > > Things in use: > Ubuntu 9.04 (jaunty) > Tomcat 6 (deb package) > Axis2 > Maven > Eclipse > other > > > There is some other information: > System.getenv("ENV_VARIABLE") will return null in this case, because the > variable doesn't exist. > if we run this snippet inside some class, which is part of our web service: > > Map map = System.getenv(); > Set keys = map.keySet(); > Iterator iterator = keys.iterator(); > while (iterator.hasNext()) { > String key = (String) iterator.next(); > String value = (String) map.get(key); > System.out.println(key + " = " + value); > > --- we will get a list of environment variables and this list is different > from that you get in command line : env > (I'm using Ubuntu) > > Even if I set up my own env variable under root(for example like this: > > sudo gedit /etc/environment > ENV_VARIABLE=/home/user/some_folder //put this line in /etc/environment and > save then reboot > ) --- then rebuild and redeploy service(just in case) which contains class > with above snippet, I cannot see ENV_VARIABLE in output of tomcat console > (catalina.sh run) > > So now the question is : > > ***How to set up your own environment variable, which you would like > to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web > service ?*** > > > Deepal Jayasinghe wrote: >> >> Hmm, I am not so sure that has something to do with the class loader, if >> that is the case then problem might be due to each service has its own >> class loader and it is different from context class loader. Anyway as I >> remember correct no one asked this kind of question before, so if you >> find that answer please post that too. >> >> Thanks, >> Deepal >> >> artifex wrote: >>> That thing didn't work because it couldn't find path to the desired >>> program >>> for execution. >>> I'm using environment variables in my java code("String envV = >>> System.getenv("ENV_VARIABLE");"), but it seems that getenv() cannot >>> find >>> the variable. I'm sure it's set up correctly. So now my goal is to find >>> out >>> how we can get environmental variables if classes which try to get it are >>> inside a web service(???)... >>> >>> ...if anyone knows please give me a hint... >>> >>> >>> artifex wrote: >>> I have deployed a webservice using Axis2. It works fine, but Here is a problem: I need to run an external program through the Client, so I've put in existing library piece of code, which contains Runtime.getRuntime(). When I run test, it works fine, but no external program is run. It seems like piece of code with "Runtime rt = Runtime.getRuntime();"(it works when is run locally) just ignored... Could anyone help me with this issue? This is class to be wrapped : package eu.project.samplewebservice; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class SampleExistingLibrary { /** * Adds two input integer parameters and returns the result. * * @param i1 * An integer input * @param i2 * An integer input * @return The integer result which is the sum of the two input integers */ public int addTwoIntegers( int i1, int i2 ) { System.out.println( "TEST!!" ); ///!!! String mkcolpath = System.getenv("MKCOLPATH"); String pafpath = System.getenv("PAFPATH"); //System.out.print(mkcolpath); try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("supertux"); //this is a game //pathToCollectionF = pafpath+"/collection.mf"; InputStream noerr = proc.getInputStream(); InputStream stderr = proc.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); InputStreamReader isr1 = new InputStreamReader(noerr); BufferedReader br1 = new BufferedReader(isr1); String line = null; //System.out.println("");
Re: Problem with Runtime.getRuntime() exec
Things in use: Ubuntu 9.04 (jaunty) Tomcat 6 (deb package) Axis2 Maven Eclipse other There is some other information: System.getenv("ENV_VARIABLE") will return null in this case, because the variable doesn't exist. if we run this snippet inside some class, which is part of our web service: Map map = System.getenv(); Set keys = map.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); String value = (String) map.get(key); System.out.println(key + " = " + value); --- we will get a list of environment variables and this list is different from that you get in command line : env (I'm using Ubuntu) Even if I set up my own env variable under root(for example like this: sudo gedit /etc/environment ENV_VARIABLE=/home/user/some_folder //put this line in /etc/environment and save then reboot ) --- then rebuild and redeploy service(just in case) which contains class with above snippet, I cannot see ENV_VARIABLE in output of tomcat console (catalina.sh run) So now the question is : ***How to set up your own environment variable, which you would like to use(var=System.getenv(ENV_VARIABLE);) inside some class of your web service ?*** Deepal Jayasinghe wrote: > > Hmm, I am not so sure that has something to do with the class loader, if > that is the case then problem might be due to each service has its own > class loader and it is different from context class loader. Anyway as I > remember correct no one asked this kind of question before, so if you > find that answer please post that too. > > Thanks, > Deepal > > artifex wrote: >> That thing didn't work because it couldn't find path to the desired >> program >> for execution. >> I'm using environment variables in my java code("String envV = >> System.getenv("ENV_VARIABLE");"), but it seems that getenv() cannot >> find >> the variable. I'm sure it's set up correctly. So now my goal is to find >> out >> how we can get environmental variables if classes which try to get it are >> inside a web service(???)... >> >> ...if anyone knows please give me a hint... >> >> >> artifex wrote: >> >>> I have deployed a webservice using Axis2. It works fine, but >>> Here is a problem: I need to run an external program through the Client, >>> so I've put in existing library piece of code, which contains >>> Runtime.getRuntime(). When I run test, it works fine, but no external >>> program is run. It seems like piece of code with "Runtime rt = >>> Runtime.getRuntime();"(it works when is run locally) just ignored... >>> Could anyone help me with this issue? >>> >>> This is class to be wrapped : >>> package eu.project.samplewebservice; >>> >>> >>> >>> import java.io.BufferedReader; >>> >>> import java.io.InputStream; >>> >>> import java.io.InputStreamReader; >>> >>> >>> >>> >>> public class SampleExistingLibrary { >>> >>> >>> >>> /** >>> >>> * Adds two input integer parameters and returns the result. >>> >>> * >>> >>> * @param i1 >>> >>> *An integer input >>> >>> * @param i2 >>> >>> *An integer input >>> >>> * @return The integer result which is the sum of the two input >>> integers >>> >>> */ >>> >>> public int addTwoIntegers( int i1, int i2 ) { >>> >>> System.out.println( "TEST!!" ); >>> >>> ///!!! >>> >>> String mkcolpath = System.getenv("MKCOLPATH"); >>> >>> String pafpath = System.getenv("PAFPATH"); >>> >>> //System.out.print(mkcolpath); >>> >>> try >>> >>> { >>> >>> Runtime rt = Runtime.getRuntime(); >>> >>> Process proc = rt.exec("supertux"); >>> //this is a game >>> //pathToCollectionF = pafpath+"/collection.mf"; >>> >>> InputStream noerr = proc.getInputStream(); >>> >>> InputStream stderr = proc.getErrorStream(); >>> >>> InputStreamReader isr = new InputStreamReader(stderr); >>> >>> BufferedReader br = new BufferedReader(isr); >>> >>> InputStreamReader isr1 = new InputStreamReader(noerr); >>> >>> BufferedReader br1 = new BufferedReader(isr1); >>> >>> String line = null; >>> >>> //System.out.println(""); >>> >>> while ( (line = br1.readLine()) != null || (line = >>> br.readLine()) != null){ >>> >>> System.out.println(line); >>> >>> } >>> >>> //System.out.println(line); >>> >>> //System.out.println(""); >>> >>> int exitVal = proc.waitFor(); >>> >>> //exitValCl=exitVal; >>> >>> System.out.println("Process exitValue: " + exitVal); >>> >>> } cat
Re: Axis2: map generic method to multiple operations in service.xml
Caristi, Joe wrote on 17.06.2009 22:47: You might be pleasantly surprised by Synapse. With just a small amount of XML you could get the forwarding accomplished. It also supports script languages right in the configuration, so you could do your pre-processing as well. Thanks for the pointer, I'll have a look at it! Best regards, Jens
Re: implementing Client as server
Hello Thank you for the response you sent Actually, i'm using Axis2-1.4.1 and have to implement handlers on both side client and server to intercept the timing of request and response messages to calculate some QoS parameters like response time, execution time and communication time between them. But unfortunatly until now i didn't succeed to intercept SOAP messages only on the server side using of course modules. So that, i thought about the solution i asked about. Now, may you propose me one of the solutions you find the best for my problem and how sould i proceed to implement it i wish i was well understood Lars Ericsson a écrit : Hi! Yes, Certenly you can, there are lot of different way to do, but i will propose you shouldn't use it directly. i'm just wonder why you want to that. do you want to add some functionality to it or what? *From:* Asma MAALEJ *To:* axis-user@ws.apache.org *Sent:* Thursday, June 18, 2009 3:06:56 PM *Subject:* implementing Client as server Hello Can somebody tell me if it is possible to change the implementation of a client of a web service, under Axis2-1.4.1 container, to an other so that it will as a service requester which call the service provider? if it is, please tell me how ? i'm looking for a positive response from you thanks
Re: implementing Client as server
Hi! Yes, Certenly you can, there are lot of different way to do, but i will propose you shouldn't use it directly. i'm just wonder why you want to that. do you want to add some functionality to it or what? From: Asma MAALEJ To: axis-user@ws.apache.org Sent: Thursday, June 18, 2009 3:06:56 PM Subject: implementing Client as server Hello Can somebody tell me if it is possible to change the implementation of a client of a web service, under Axis2-1.4.1 container, to an other so that it will as a service requester which call the service provider? if it is, please tell me how ? i'm looking for a positive response from you thanks
implementing Client as server
Hello Can somebody tell me if it is possible to change the implementation of a client of a web service, under Axis2-1.4.1 container, to an other so that it will as a service requester which call the service provider? if it is, please tell me how ? i'm looking for a positive response from you thanks
AXIS2: How to load configurationcontext (axis2.xml) inside a J2EE-application acting as WS-client?
Hi, I have the following problem: (I'm using Axis2 1.3 in combination with rampart 1.3) I want to write a webservice-client running inside a j2ee-environment (packed in an ear-file) (The webservice-call is triggered by a MDB inside the J2EE-environment) The webservice-provider demands a secured call. Thus I had to add the following to the axis2.xml: Timestamp Signature client abc.def.PWCBHandler abc/def/crypto.properties DirectReference My test-client, written as POJO: ... WSStub stub=null; String url = "http://rst.xyz:8000/axis2/services/WS";; String AXIS2_PATH="C:\\ws\\axis2-1.3"; String CLIENT_REPO_PATH=AXIS2_PATH+"\\repository "; String CLIENT_CONFIG_PATH=AXIS2_PATH+"\\conf\\axis2.xml "; ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH, CLIENT_CONFI G_PATH); stub = new WSStub(ctx,url); stub._getServiceClient().engageModule("rampart-1.3"); stub.aMethod(); ... works without any problems! But when I want to put this coding into a J2EE-environment, then the following problem arise: It is not allowed to access the file-system inside J2EE-environment, thus using "ConfigurationContextFactory.createConfigurationContextFromFileSystem" is not possible. Using "ConfigurationContextFactory.createConfigurationContextFromURIs" is also not possible, because I can not make any further assumptions about the destination-environment. (thus accessing the axis2.xml via file-url or http-url is not preferably) I wish to put the axis2.xml into the jar (inside the ear-file) and access it via "getSystemRessourceAsStream" or something like that. Thus the ear-file itself would contains everything it needs. But the ConfigurationContextFactory-class has no API for this. In my understanding the only way to set outflow-security is via axis2.xml and the only way to change this global behaviour is via axis2.xml. Or am I wrong? (I found a Class "OutflowConfiguration" for programmatically setting this, but that class is deprecated.) What do you recommend to load the axis2-configurationcontext (axis2.xml) inside a J2EE-application acting as WS-client? Many thanks in advance!! KR Torsten Goncz