unregister
unregister
RE: Axis2 service and spring problem, can't find Spring's ApplicationContext.
Hi. Thanks alot! When I created my own ApplicationContextHolder everything worked. Thanks for all your help, much appreciated after this has taken me alot more time then it probably should have.. :) -Az. > Apart from this code, is spring and axis2 running together in your web > service? I thought you said it was. I think I know what your are > asking for, but without knowing what "TavernaBaseProfile" is doing, > I'd be concerned that it creates two separate Spring worlds in your > app - you probably don't want that. Anyways, with that caveat, if you > just need "ApplicationContext" to pass into "TavernaBaseProfile" , I > would do the following: > > Keep axis2 and spring as is, since its working. The idea behind the > axis2 ApplicationContextHolder is a known way to get an > ApplicationContext, and can be used outside axis2. So I think you > should create your own. Its easy, and it seems far less confusing, at > least to me, to use your own ApplicationContextHolder outside of axis2 > when using SpringServletContextObjectSupplier. So you'd need this xml > in your Spring config: > > > class="mypackage.spring.ApplicationContextHolder" /> > > > And this class in your app: > > package mypackage.spring; > > import org.springframework.beans.BeansException; > import org.springframework.context.ApplicationContext; > import org.springframework.context.ApplicationContextAware; > > /** Implementation of a Spring interface who is configured in Spring's > * applicationContext.xml or some other Spring type of way. This class > * and the spring bean needed to wire it could be used as an alternative > * to getting the ApplicationContext from the ServletContext. It also can > * be used to get access to spring beans in places like junit that are not > * spring aware. > */ > public class ApplicationContextHolder implements ApplicationContextAware { > > private static ApplicationContext appCtx; > > public ApplicationContextHolder() {} > > /** Spring supplied interface method for injecting app context. */ > public void setApplicationContext(ApplicationContext applicationContext) > throws BeansException { > appCtx = applicationContext; > } > > /** Access to spring wired beans. */ > public static ApplicationContext getContext() { > return appCtx; > } > > } > > Then instead of: > > ApplicationContext context = new > RavenAwareClassPathXmlApplicationContext("context.xml"); > > Do this: > > ApplicationContext ctx = ApplicationContextHolder.getContext(); > TavernaBaseProfile profile = new TavernaBaseProfile(context); > > Good luck, > Robert _ Ditt liv. Dine ting. Alt på ett sted med Windows Live™. http://windowslive.no
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
On Thu, Apr 2, 2009 at 4:05 PM, Azazel Se wrote: >> Date: Thu, 2 Apr 2009 15:01:48 -0300 >> Subject: Re: Axis2 service and spring problem, can't find Spring's >> ApplicationContext. >> From: robertlazar...@gmail.com >> To: axis-user@ws.apache.org >> >> On Thu, Apr 2, 2009 at 1:48 PM, Azazel Se wrote: >> >> From: robertlazar...@gmail.com >> >> >> >> "ApplicationContextHolder.getContext()" isn't needed when using >> >> SpringServletContextObjectSupplier. If spring and axis2 are working >> >> together, you are done. You have to configure Spring to use >> >> ApplicationContextHolder, otherwise it will return null values. >> >> >> >> - R >> > >> >> From: sagara.gunathu...@gmail.com >> >> To: axis-user@ws.apache.org >> > >> >> Here, how you try to use context .and can you provide error trace you >> >> got ? i cant get any clue with supplied details . >> >> > . ApplicationContext ctx = ApplicationContextHolder.getContext(); >> >> I don't think you need to have this line to access SpringContext >> >> explicitly , because "MyServ " is already a Spring manged bean. if you >> >> want to access any other bean inside "MyServ " use Spring injection >> >> instead of access through ApplicationContextHolder. >> > >> > >> > >> > >> > Hi, thanks for the replies. >> > >> > I have an application which I didn't make which uses spring, it has an >> > API >> > which hides the details and preferably I don't add any more stuff to it. >> > The >> > goal is to just use a few of the methods and get returns as normal and >> > not >> > interact directly with spring. I have never used Spring before so my >> > knowledge about the innerworkings is small but if I get the API to work >> > I >> > shouldn't need to either. The springappl needs the context at >> > initiating. I >> > have tested it in a jsp file and it works, but I want to move it to a >> > web >> > service. In the jsp file I had the same context stuff added to the >> > web.xml >> > and this is in the jsp file: >> > >> > MyApplWithSpring ap = new >> > >> > MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext())); >> > >> > This worked and I could use some of its methods afterwards. >> > So I thought it would work in the web service as well if I used >> > ApplicationContextHolder.getContext() and used new >> > MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how >> > do >> > I configure spring to use the ApplicationContextHolder so that it isn't >> > null? Or is there any other(/better) way I can do this? >> > >> > -Az. >> > >> >> So the "springappl" you didn't write requires an ApplicationContext >> reference, even though you are successfully using >> SpringServletContextObjectSupplier that doesn't really require an >> ApplicationContext reference? If so, I'll show you how to do it. >> >> - R > > > > At the bottom are the first few lines of the code that works in eclipse. The > problems arise when wanting to deploy to axis2 and tomcat. The application I > am making a small wrapper for is very big and complex and the context.xml > imports several other xml files. The goal of the web service is to receive a > string from the client, use the application to do some stuff with a file and > the string as input, then return the results to the client. The application > uses spring, hibernate etc. > > -Az. > > > //Create Platform. > ApplicationContext context = new > RavenAwareClassPathXmlApplicationContext("context.xml"); > TavernaBaseProfile profile = new TavernaBaseProfile(context); > //Get workflow parser, load workflow. > WorkflowParser parser = profile.getWorkflowParser(); > URL workflowURL = new URL("http://foo.com/workflow.xml";); > Dataflow workflow = parser.createDataflow(workflowURL); > Apart from this code, is spring and axis2 running together in your web service? I thought you said it was. I think I know what your are asking for, but without knowing what "TavernaBaseProfile" is doing, I'd be concerned that it creates two separate Spring worlds in your app - you probably don't want that. Anyways, with that caveat, if you just need "ApplicationContext" to pass into "TavernaBaseProfile" , I would do the following: Keep axis2 and spring as is, since its working. The idea behind the axis2 ApplicationContextHolder is a known way to get an ApplicationContext, and can be used outside axis2. So I think you should create your own. Its easy, and it seems far less confusing, at least to me, to use your own ApplicationContextHolder outside of axis2 when using SpringServletContextObjectSupplier. So you'd need this xml in your Spring config: And this class in your app: package mypackage.spring; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** Implementation of a Spring interface who is configured in Spring's * applicationContext.xml or some other Spring type of way. This class * and the s
RE: Axis2 service and spring problem, can't find Spring's ApplicationContext.
> Date: Thu, 2 Apr 2009 15:01:48 -0300 > Subject: Re: Axis2 service and spring problem, can't find Spring's > ApplicationContext. > From: robertlazar...@gmail.com > To: axis-user@ws.apache.org > > On Thu, Apr 2, 2009 at 1:48 PM, Azazel Se wrote: > >> From: robertlazar...@gmail.com > >> > >> "ApplicationContextHolder.getContext()" isn't needed when using > >> SpringServletContextObjectSupplier. If spring and axis2 are working > >> together, you are done. You have to configure Spring to use > >> ApplicationContextHolder, otherwise it will return null values. > >> > >> - R > > > >> From: sagara.gunathu...@gmail.com > >> To: axis-user@ws.apache.org > > > >> Here, how you try to use context .and can you provide error trace you > >> got ? i cant get any clue with supplied details . > >> > . ApplicationContext ctx = ApplicationContextHolder.getContext(); > >> I don't think you need to have this line to access SpringContext > >> explicitly , because "MyServ " is already a Spring manged bean. if you > >> want to access any other bean inside "MyServ " use Spring injection > >> instead of access through ApplicationContextHolder. > > > > > > > > > > Hi, thanks for the replies. > > > > I have an application which I didn't make which uses spring, it has an API > > which hides the details and preferably I don't add any more stuff to it. The > > goal is to just use a few of the methods and get returns as normal and not > > interact directly with spring. I have never used Spring before so my > > knowledge about the innerworkings is small but if I get the API to work I > > shouldn't need to either. The springappl needs the context at initiating. I > > have tested it in a jsp file and it works, but I want to move it to a web > > service. In the jsp file I had the same context stuff added to the web.xml > > and this is in the jsp file: > > > > MyApplWithSpring ap = new > > MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext())); > > > > This worked and I could use some of its methods afterwards. > > So I thought it would work in the web service as well if I used > > ApplicationContextHolder.getContext() and used new > > MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how do > > I configure spring to use the ApplicationContextHolder so that it isn't > > null? Or is there any other(/better) way I can do this? > > > > -Az. > > > > So the "springappl" you didn't write requires an ApplicationContext > reference, even though you are successfully using > SpringServletContextObjectSupplier that doesn't really require an > ApplicationContext reference? If so, I'll show you how to do it. > > - R At the bottom are the first few lines of the code that works in eclipse. The problems arise when wanting to deploy to axis2 and tomcat. The application I am making a small wrapper for is very big and complex and the context.xml imports several other xml files. The goal of the web service is to receive a string from the client, use the application to do some stuff with a file and the string as input, then return the results to the client. The application uses spring, hibernate etc. -Az. //Create Platform. ApplicationContext context = new RavenAwareClassPathXmlApplicationContext("context.xml"); TavernaBaseProfile profile = new TavernaBaseProfile(context); //Get workflow parser, load workflow. WorkflowParser parser = profile.getWorkflowParser(); URL workflowURL = new URL("http://foo.com/workflow.xml";); Dataflow workflow = parser.createDataflow(workflowURL); _ Windows Live™ Mail. Flere kontoer på ett sted. http://download.live.com/wlmail
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
On Thu, Apr 2, 2009 at 1:48 PM, Azazel Se wrote: >> From: robertlazar...@gmail.com >> >> "ApplicationContextHolder.getContext()" isn't needed when using >> SpringServletContextObjectSupplier. If spring and axis2 are working >> together, you are done. You have to configure Spring to use >> ApplicationContextHolder, otherwise it will return null values. >> >> - R > >> From: sagara.gunathu...@gmail.com >> To: axis-user@ws.apache.org > >> Here, how you try to use context .and can you provide error trace you >> got ? i cant get any clue with supplied details . >> > . ApplicationContext ctx = ApplicationContextHolder.getContext(); >> I don't think you need to have this line to access SpringContext >> explicitly , because "MyServ " is already a Spring manged bean. if you >> want to access any other bean inside "MyServ " use Spring injection >> instead of access through ApplicationContextHolder. > > > > > Hi, thanks for the replies. > > I have an application which I didn't make which uses spring, it has an API > which hides the details and preferably I don't add any more stuff to it. The > goal is to just use a few of the methods and get returns as normal and not > interact directly with spring. I have never used Spring before so my > knowledge about the innerworkings is small but if I get the API to work I > shouldn't need to either. The springappl needs the context at initiating. I > have tested it in a jsp file and it works, but I want to move it to a web > service. In the jsp file I had the same context stuff added to the web.xml > and this is in the jsp file: > > MyApplWithSpring ap = new > MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext())); > > This worked and I could use some of its methods afterwards. > So I thought it would work in the web service as well if I used > ApplicationContextHolder.getContext() and used new > MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how do > I configure spring to use the ApplicationContextHolder so that it isn't > null? Or is there any other(/better) way I can do this? > > -Az. > So the "springappl" you didn't write requires an ApplicationContext reference, even though you are successfully using SpringServletContextObjectSupplier that doesn't really require an ApplicationContext reference? If so, I'll show you how to do it. - R
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
As mentioned in previous mails "ApplicationContextHolder.getContext()" is not required to handle this , i think reading some Spring docs will helpful to you because this is a problem with the the way you retrieve beans from spring context. First create your service as a POJO service and configure it within SpringContext , then as you already did ,expose this service bean as a web service using Axis2 "SpringServletContextObjectSupplier" in this case you don't need to modify your java codes to expose your spring bean as a web service. Thanks , On Thu, Apr 2, 2009 at 10:18 PM, Azazel Se wrote: >> From: robertlazar...@gmail.com >> >> "ApplicationContextHolder.getContext()" isn't needed when using >> SpringServletContextObjectSupplier. If spring and axis2 are working >> together, you are done. You have to configure Spring to use >> ApplicationContextHolder, otherwise it will return null values. >> >> - R > >> From: sagara.gunathu...@gmail.com >> To: axis-user@ws.apache.org > >> Here, how you try to use context .and can you provide error trace you >> got ? i cant get any clue with supplied details . >> > . ApplicationContext ctx = ApplicationContextHolder.getContext(); >> I don't think you need to have this line to access SpringContext >> explicitly , because "MyServ " is already a Spring manged bean. if you >> want to access any other bean inside "MyServ " use Spring injection >> instead of access through ApplicationContextHolder. > > > > > Hi, thanks for the replies. > > I have an application which I didn't make which uses spring, it has an API > which hides the details and preferably I don't add any more stuff to it. The > goal is to just use a few of the methods and get returns as normal and not > interact directly with spring. I have never used Spring before so my > knowledge about the innerworkings is small but if I get the API to work I > shouldn't need to either. The springappl needs the context at initiating. I > have tested it in a jsp file and it works, but I want to move it to a web > service. In the jsp file I had the same context stuff added to the web.xml > and this is in the jsp file: > > MyApplWithSpring ap = new > MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext())); > > This worked and I could use some of its methods afterwards. > So I thought it would work in the web service as well if I used > ApplicationContextHolder.getContext() and used new > MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how do > I configure spring to use the ApplicationContextHolder so that it isn't > null? Or is there any other(/better) way I can do this? > > -Az. > > > > > New java class, only added the fourth line and this gives an error since con > is null: > --- > public class MyServ { > public String serExe() { > ApplicationContext con = ApplicationContextHolder.getContext(); > MyApplWithSpring ap = new MyApplWithSpring(con); > return "testWithSpringAppl"; > } > } > > > Exception in eclipse when running client: > --- > Exception in thread "main" org.apache.axis2.AxisFault: Cannot attach a > profile to a null context > at > org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512) > at > org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370) > at > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416) > at > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228) > at > org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) > at xyz.MyServStub.serExe(MyServStub.java:183) > at xyz.MyServClient.main(MyServClient.java:17) > > > Output of Exception at runtime in the tomcat server: > -- > ERROR - RPCMessageReceiver.invokeBusinessLogic(157) | Cannot attach a > profile to > a null context > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > sorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav > a:165) > at > org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic > (RPCMessageReceiver.java:102) > at > org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines > sLogic(AbstractInOutMessageReceiver.java:40) > at > org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe > ssageReceiver.java:100) > at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) > at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq > uest(HTTPT
RE: Axis2 service and spring problem, can't find Spring's ApplicationContext.
> From: robertlazar...@gmail.com > > "ApplicationContextHolder.getContext()" isn't needed when using > SpringServletContextObjectSupplier. If spring and axis2 are working > together, you are done. You have to configure Spring to use > ApplicationContextHolder, otherwise it will return null values. > > - R > From: sagara.gunathu...@gmail.com > To: axis-user@ws.apache.org > Here, how you try to use context .and can you provide error trace you > got ? i cant get any clue with supplied details . > > . ApplicationContext ctx = ApplicationContextHolder.getContext(); > I don't think you need to have this line to access SpringContext > explicitly , because "MyServ " is already a Spring manged bean. if you > want to access any other bean inside "MyServ " use Spring injection > instead of access through ApplicationContextHolder. Hi, thanks for the replies. I have an application which I didn't make which uses spring, it has an API which hides the details and preferably I don't add any more stuff to it. The goal is to just use a few of the methods and get returns as normal and not interact directly with spring. I have never used Spring before so my knowledge about the innerworkings is small but if I get the API to work I shouldn't need to either. The springappl needs the context at initiating. I have tested it in a jsp file and it works, but I want to move it to a web service. In the jsp file I had the same context stuff added to the web.xml and this is in the jsp file: MyApplWithSpring ap = new MyApplWithSpring(WebApplicationContextUtils.getWebApplicationContext(getServletContext())); This worked and I could use some of its methods afterwards. So I thought it would work in the web service as well if I used ApplicationContextHolder.getContext() and used new MyApplWithSpring(ApplicationContextHolder.getContext()). If possible how do I configure spring to use the ApplicationContextHolder so that it isn't null? Or is there any other(/better) way I can do this? -Az. New java class, only added the fourth line and this gives an error since con is null: --- public class MyServ { public String serExe() { ApplicationContext con = ApplicationContextHolder.getContext(); MyApplWithSpring ap = new MyApplWithSpring(con); return "testWithSpringAppl"; } } Exception in eclipse when running client: --- Exception in thread "main" org.apache.axis2.AxisFault: Cannot attach a profile to a null context at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at xyz.MyServStub.serExe(MyServStub.java:183) at xyz.MyServClient.main(MyServClient.java:17) Output of Exception at runtime in the tomcat server: -- ERROR - RPCMessageReceiver.invokeBusinessLogic(157) | Cannot attach a profile to a null context java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.jav a:165) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusines sLogic(AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMe ssageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq uest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1 33) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(St
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
On Thu, Apr 2, 2009 at 12:01 PM, Azazel Se wrote: > Thanks Sagara. > I actually tried that one first but I didn't know which of the suppliers > was the correct one so I tried both. In my mail I pasted the exception > from SpringAppContextAwareObjectSupplier twice by accident. When > using SpringServletContextObjectSupplier I got a "No bean named 'MyServ' > exception, but when I added: > > class="xyz.MyServ"> > > > to the context.xml file the error went away. So now it deploys and runs > without errors, I also got the test string back in my ws-client. But later > when I tried using the context I get > from ApplicationContextHolder.getContext() I found that it has value null??? > Anyone know why? > "ApplicationContextHolder.getContext()" isn't needed when using SpringServletContextObjectSupplier. If spring and axis2 are working together, you are done. You have to configure Spring to use ApplicationContextHolder, otherwise it will return null values. - R
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
Hi Azazel , > But later > when I tried using the context I get > from ApplicationContextHolder.getContext() I found that it has value null??? > Anyone know why? Here, how you try to use context .and can you provide error trace you got ? i cant get any clue with supplied details . > . ApplicationContext ctx = ApplicationContextHolder.getContext(); I don't think you need to have this line to access SpringContext explicitly , because "MyServ " is already a Spring manged bean. if you want to access any other bean inside "MyServ " use Spring injection instead of access through ApplicationContextHolder. as a example if you want to access "dbService" bean , just add setter and getter methods to"MyServ " class and use appContext.xml file to inject that "dbService" I think you already familiar with this approach :) with Axis2 you can use Spring programing approach without any modification. I think this will resolve your problem too. Thanks , -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://sagaras.awardspace.com/
AW: Adding authentication for a generated client
Hi Eduard, you can try this tutorial: http://wso2.org/library/240 hope that helps. best regards Werner Von: Eduard Martínez An: axis-user@ws.apache.org Gesendet: Donnerstag, den 2. April 2009, 16:36:14 Uhr Betreff: Adding authentication for a generated client Hello! I'm new with Axis and WS; I'm trying to build a webservice which requires authentication, only username & password (no encryption needed). I wrote a WSDL file and then I generated the java client & server classes in eclipse (like with wsdl2java). Now the WS is working but with no authentication. I started following this tutorial: http://www.javaranch.com/journal/200709/web-services-authentication-axis2.html and now I can get authentication working in the server side (I suppose), adding the rampart module and this code in the services.xml: UsernameToken Timestamp tests.security.PasswordCallBackHandler But I don't know how to add the authentication headers with the generated code in the client side. Someone have some guidelines? Thanks!
RE: Axis2 service and spring problem, can't find Spring's ApplicationContext.
Thanks Sagara. I actually tried that one first but I didn't know which of the suppliers was the correct one so I tried both. In my mail I pasted the exception from SpringAppContextAwareObjectSupplier twice by accident. When using SpringServletContextObjectSupplier I got a "No bean named 'MyServ' exception, but when I added: to the context.xml file the error went away. So now it deploys and runs without errors, I also got the test string back in my ws-client. But later when I tried using the context I get from ApplicationContextHolder.getContext() I found that it has value null??? Anyone know why? -Az. (I have added the information about my files written in my first mail since this might be needed to see the new error.) MyServ.java - . import org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder; . import org.springframework.context.ApplicationContext; . public class MyServ { . public String serExe() { . ApplicationContext ctx = ApplicationContextHolder.getContext(); . return "test"; } } The services.xml: - blabla org.apache.axis2.extensions.spring.receivers. SpringServletContextObjectSupplier MyServ xyz.MyServ Added to rest of the properties etc in the context.xml file: - The web.xml: http://java.sun.com/dtd/web-app_2_3.dtd"; > Blabla AxisServlet Apache-Axis Servlet org.apache.axis2.transport.http.AxisServlet 1 AxisServlet /services/* contextConfigLocation /WEB-INF/context.xml contextClass ( path of a specific kind of WebApplicationContext class which the SpringAppl expects...) org.springframework.web.context.ContextLoaderListener _ Få nye Windows Live™ Messenger. http://download.live.com/messenger
Adding authentication for a generated client
Hello! I'm new with Axis and WS; I'm trying to build a webservice which requires authentication, only username & password (no encryption needed). I wrote a WSDL file and then I generated the java client & server classes in eclipse (like with wsdl2java). Now the WS is working but with no authentication. I started following this tutorial: http://www.javaranch.com/journal/200709/web-services-authentication-axis2.htmland now I can get authentication working in the server side (I suppose), adding the rampart module and this code in the services.xml: UsernameToken Timestamp tests.security.PasswordCallBackHandler But I don't know how to add the authentication headers with the generated code in the client side. Someone have some guidelines? Thanks!
wsdl2java
OK, looking for something definitive here. I am running Axis 1.4 (Implementation-Version: 1.4 1855 April 22 2006) Trying to convert some wsdl generated from Microsoft WCF to java stubs using wsdl2java, and running into some problems. The WCF side of my team says java has trouble with tree wsdl (wdl:import, xsd:import). I have trouble believing this is true, and assume that wcf is generating non standard wsdl. So, can wsdl2java under Axis 1.4 support tree wsdl? Or am I barking up the wrong... Ed
Re: Need help- with Axis2 1.1
Hi Pricilla, Axis2 installation guide[1] describe how to install on a web server like JBoss , then refer Axis2 Quick Start Guide[2] to create your first service. Also if it is possible move to latest Axis2 version like 1.4.1. [1] - http://ws.apache.org/axis2/1_4_1/installationguide.html#servlet_container [2] - http://ws.apache.org/axis2/1_4_1/quickstartguide.html Thanks , On Thu, Apr 2, 2009 at 3:01 PM, pricilla p wrote: > > > Hi, > > I have downloaded axis2-1.1.1 to my system > I also have jboss-3.0.4_tomcat-4.0.6 installed. > > Could you please give me the series of steps to be followed to create a web > service using axis2-1.1.1. > > Thanks in advance. > > Regards, > Pricilla > -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://sagaras.awardspace.com/
Need help- with Axis2 1.1
Hi, I have downloaded axis2-1.1.1 to my system I also have jboss-3.0.4_tomcat-4.0.6 installed. Could you please give me the series of steps to be followed to create a web service using axis2-1.1.1. Thanks in advance. Regards, Pricilla
SOAP problem
Hi, I'm using this code to configuer axis engine: public static EngineConfiguration createClientConfig() { SimpleProvider clientConfig = new SimpleProvider(); Handler securitySenderHandler = (Handler) new WSDoAllSender(); securitySenderHandler.setOption(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); securitySenderHandler.setOption(WSHandlerConstants.USER, "cert"); securitySenderHandler.setOption(WSHandlerConstants.SIG_KEY_ID, "DirectReference"); securitySenderHandler.setOption(WSHandlerConstants.MUST_UNDERSTAND, "false"); securitySenderHandler.setOption(WSHandlerConstants.SIG_PROP_FILE, "clientCrypto.properties"); securitySenderHandler.setOption(WSHandlerConstants.PW_CALLBACK_CLASS, "PWCallback"); SimpleChain reqHandler = new SimpleChain(); SimpleChain respHandler = new SimpleChain(); reqHandler.addHandler(securitySenderHandler); Handler pivot = (Handler) new HTTPSender(); Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler); clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME,transport); return clientConfig; } SOAP envelope im sending lost couple lines in the end of message... Can any body halp me ? Some sugestion? Best regards MO
Re: [Axis2] Rampart/WSS4J timestamp check
Hi, I am facing the same problem as mentioned by you.I hope you have found the solution to this. I want to get the correct settings done on the server side as so far i have'nt set the 'timetolive' parameter on server side services.xml . The client for my service is a .net clientwhich is setting "time expire" parameter as currenttime+12 hours,but on the server side i am unable to do the same and when the client sends a request with time difference of more than 5 mins ,the service throws the "WSDOAll receiver " fault . I know that it is to be handled on server side now,please help. My services.xml is as follows : Web Service for saving the account details in Server database http://www.w3.org/2004/08/wsdl/in-only"; class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> http://www.w3.org/2004/08/wsdl/in-out"; class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier sendSms UsernameToken Timestamp com.knowcross.gmhs.wsdldao.htngmodule.HtngSecurityCallbackHandler Regards, Amit Swaroop Jos Dirksen wrote: > > Hi, > > I'm currently trying out some scenarios with Rampart and run into an issue > with the Rampart module. When just specifying the timeout security action, > this timeout isn't checked by the incoming security handler. Is this > correct behaviour? > > On the serverside I specified the following: > > > > Timestamp > > > > And on the client side I've configured it like this: > > > > Timestamp > 1 > > > > When I delay the sending of the message (e.g. by debugging) the message is > still accepted at the server even though the ttl has passed. When I debug > somewhat deeper into the WSS4J code, I don't see a check there. > > I hope this is the correct forum to ask this question, if not I'll try at > the WSS4J forum. > -- View this message in context: http://www.nabble.com/-Axis2--Rampart-WSS4J-timestamp-check-tp6156270p22843553.html Sent from the Axis - User mailing list archive at Nabble.com.
Re: Axis2 service and spring problem, can't find Spring's ApplicationContext.
Hi Azazel, > > org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier You are loading SpringAppContext through ContextLoaderListener , so you should use SpringServletContextObjectSupplier instead of SpringAppContextAwareObjectSupplier. org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier Thanks , -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://sagaras.awardspace.com/
Axis2 service and spring problem, can't find Spring's ApplicationContext.
Hi. I have added Axis2 and a service to a web application. I tried first with a simple echo string method in the service which I have gotten to work. But when I add ApplicationContextHolder.getContext() to the method there is an exception when the client tries to connect to the web service, and Tomcat shows the error can't find Spring's ApplicationContext. When deployed to Tomcat there was no errors. I have read about the spring axis2 integration problem and tried following the guides (for instance on the apache axis2 site). My goal is to get the context.xml so that I can send it as parameter when instantiating an application I want to use which uses spring ( new SpringAppl sa = new SpringAppl(ApplicationContextHolder.getContext()); ) and then use a couple of methods in that class and return a result to the client using the service. Anyone know what I am doing wrong? Exceptions and content of the files I am using are pasted below. -Az. The exceptions: (The first from when I used "springappcontext.." in the services.xml and the second when I used the "springappcontext...") Caused by: java.lang.Exception: Axis2 Can't find Spring's ApplicationContext at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:53) ... 28 more --- Caused by: org.apache.axis2.AxisFault: Axis2 Can't find Spring's ApplicationCont ext at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:63) ... 28 more Caused by: java.lang.Exception: Axis2 Can't find Spring's ApplicationContext at org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObj ectSupplier.getServiceObject(SpringAppContextAwareObjectSupplier.java:53) ... 28 more The java class: --- . package xyz; . import org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder; . import org.springframework.context.ApplicationContext; . public class MyServ { . public String serExe() { .ApplicationContext ctx = ApplicationContextHolder.getContext(); .return "test"; . } .} The services.xml: - blabla org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier MyServ xyz.MyServ The web.xml: http://java.sun.com/dtd/web-app_2_3.dtd"; > Blabla AxisServlet Apache-Axis Servlet org.apache.axis2.transport.http.AxisServlet 1 AxisServlet /services/* contextConfigLocation /WEB-INF/context.xml contextClass ( path of a specific kind of WebApplicationContext class which the SpringAppl expects...) org.springframework.web.context.ContextLoaderListener _ Ditt liv. Dine ting. Alt på ett sted med Windows Live™. http://windowslive.no