Hi Benedikt, On 9/8/2010 5:57 AM, Benedikt Heintel wrote: > If there is no id in the header, Axis will proceed its normal procedure > and in the end call the service with "java -cp > de.tud.informatik.seceng.calc.Calculator.class add 40 10". > > Else if the id parameter is set, it should call the same service with > "java -javaagent:agent.jar=200 -cp > de.tud.informatik.seceng.calc.Calculator.class add 40 10".
This is the misunderstanding here, I think. Axis2 does not actually spawn a separate process/JVM for each invocation. All Axis2 processing happens in a single JVM, and the "end of the road" as far as we're concerned is something called a MessageReceiver - a special Handler whose job is to do the "real work" (i.e. the business logic) of the service. Of course, nothing prevents the MessageReceiver from invoking another process itself, but then we come to our second issue. Service classes are called directly by Axis2, without a command-line interface. So rather than "java Calculator add 40 10" (which calls Calculator.main()), we end up invoking calculator.add(40, 10) on an instance of Calculator. So... if your service class (Calculator in the example here) is already set up to process command line arguments, you can certainly write a custom MessageReceiver which unpacks the SOAP request into string arguments and then invokes your class with or without the -javaagent argument depending on the presence or absence of the header. While this would work, it does lose a lot of the convenience and power of the Axis2 framework, not to mention that spawning a separate JVM for each and every web service invocation would be quite expensive and slow. Have you considered alternatives to the need for the -javaagent argument? I believe you said you needed this for custom logging.... is there some way you can either use another logging framework, or modify the one you've got to have finer-grained control inside a JVM (so you can still run in-process but have the logs configured on a per-request basis, perhaps with a thread-local)? Thanks, --Glen --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org