RE: using handlers to identify who is requesting service
Hi, I guess you want your service to access some parameter made available by the handler. You don't need to get the instance of the backend service in the handler. Besides, the service's implementation can access the instance of MessageContext being manipulated by the request chain using MessageContext's static method getCurrentContext(). Add your parameters to the properties of the message context than retrieve those properties in your backend service. Regards, Tony -Message d'origine- De : Arnaldur Hilmisson [mailto:[EMAIL PROTECTED] Envoyé : jeudi 24 novembre 2005 12:00 À : axis-user@ws.apache.org Objet : using handlers to identify who is requesting service Hi I have a small problem with my ws. I'm exposing an api on a framework I'm using and would like to know if a custom handler can get the instance of the backend service, before the request is made, in order to set a parameter in the service class? Basicly I'm trying to get a param from an URL and set it as a private variable in a session bean , because I don't want to add this as a parameter to every soap call. Regards Arnaldur
RE: using handlers to identify who is requesting service
I haven't tried using getCurrentContext() with EJB's deployed in other packages. It may work, because the current instance of MessageContext must stay in scope until the full treatment of the response message is completed. It is normally not possible for the handler to access the backend service. According to the Axis Architecture Guide, the LAST handler in the server's request chain dispatches the request to the backend implementation after all the preceding handlers have been invoked. Besides, if you're dispatching to a session stateless EJB, you're not even sure about the way JBoss is creating instances of your EJB classes. I think that working things out with message contexts is much more straightforward. -Message d'origine- De : Arnaldur Hilmisson [mailto:[EMAIL PROTECTED] Envoyé : jeudi 24 novembre 2005 14:04 À : axis-user@ws.apache.org Objet : Re: using handlers to identify who is requesting service Hi, The problem is that the service bean is in another package (both packages are in jboss), does that work with the static method getCurrentContext()? And just to be sure... is there no way for the handler to call a method in the backend service before the actual call is made? Regards Arnaldur
RE: Dealing with sessions
Hi, Axis lets you define and deploy HANDLERS in order to customize the SOAP processing chain. Handlers are similar in many ways to the filters used for interception in webapps. The use case you described could be easily implemented using handlers. For more information on this, please refer to the Axis Architecture Guide and the Axis API documentation. Regards, Tony -Message d'origine- De : Rakesh Patel [mailto:[EMAIL PROTECTED] Envoyé : jeudi 24 novembre 2005 17:39 À : axis Objet : Dealing with sessions Hi, i've just started to build my first app using web services and Axis. My business interface has a simple logon method that (if successful) returns a token. This token is to be used for subsequent method calls (it essentially allows me to have a timed session). The question I have is that i now need to add an additional parameter for this token to each business method call. Is there a way around this? I'd much prefer to keep my business methods ignorant of the token. In a typical web app I have used filters for interception. I'm not sure how i could do that with web services. Thanks Rakesh
RE: Two questions: How a handler can get the property in a stub and How to get the parameters set in the wsdd file?
Hi, I am new to use axis and trying to use a stub to invoke a service. I also deploy a handler at the client side. So there are two questions. Hi, 1): I use _setProperty(java.lang.String name, java.lang.Object value) to set some property to the stub, how can I get the property I set within the Handler? When the client makes a request, all the stub's properties are passed to the instance of MessageContext being manipulated by the handlers on the client's request chain. For more explanation, check this older message on the Axis mailing list: http://marc.theaimsgroup.com/?l=axis-userm=112953519731682w=2 2): I set some parameters in the service-deploy.wsdd file, how can I get them in the service? Are you talking about service parameters or handler parameters ? Hope I can get your kindly help. Thanks a lot
RE: One Handler for request and response?
Robert, You can declare a handler only once as a child element of globalConfiguration and give it a name attribute, just like URLMapper or LocalResponder. The specified name could be used later to reference the handler. Declaring a handler this way doesn't guarantee having only one object created. Besides, handlers should be completely stateless objects and manipulate only the data transmitted via MessageContext. Having one or multiple instances created should not be a design issue. Regards, Tony -Message d'origine- De : news [mailto:[EMAIL PROTECTED] De la part de Robert Simmons Jr. Envoyé : mercredi 16 novembre 2005 19:51 À : axis-user@ws.apache.org Objet : One Handler for request and response? Greetings, I currently use a handler to do some stuff to the request and response and I wanted to know if it was possible to have it so that one object would be doing both. I have the configuration pasted below and you will see that I have to create 2 instance of ContentCryptoHandler in my HTTP protocol config and I would rahter have just one. Any way to do that ? TIA ?xml version=1.0 encoding=UTF-8? deployment xmlns=http://xml.apache.org/axis/wsdd/; xmlns:java=http://xml.apache.org/axis/wsdd/providers/java; globalConfiguration parameter name=adminPassword value=nimda/ parameter name=attachments.Directory value=C:\temp\MobileLDAP\attachments/ parameter name=disablePrettyXML value=true/ parameter name=attachments.implementation value=org.apache.axis.attachments.AttachmentsImpl/ parameter name=sendXsiTypes value=true/ parameter name=sendMultiRefs value=true/ parameter name=sendXMLDeclaration value=true/ /globalConfiguration handler name=LocalResponder type=java:org.apache.axis.transport.local.LocalResponder/ handler name=URLMapper type=java:org.apache.axis.handlers.http.URLMapper/ handler name=Authenticate type=java:org.apache.axis.handlers.SimpleAuthenticationHandler/ service name=Version provider=java:RPC parameter name=allowedMethods value=getVersion/ parameter name=className value=org.apache.axis.Version/ /service service name=MobileLDAP provider=java:RPC style=wrapped use=literal documentationProvides Mobile Access to LDAP./documentation parameter name=allowedMethods value=getSimpleSearchFilter, searchForContacts/ parameter name=className value=com.jambit.mobileLDAP.WSMobileLDAP/ parameter name=scope value=session/ beanMapping languageSpecificType=java:com.jambit.mobileLDAP.Contact qname=ns1:Contact xmlns:ns1=urn:com.jambit.MobileLDAP/ namespaceurn:com.jambit.MobileLDAP/namespace /service transport name=http requestFlow handler type=URLMapper/ handler type=java:org.apache.axis.handlers.http.HTTPAuthHandler/ handler type=java:com.jambit.axis.handlers.ContentCryptoHandler/ /requestFlow responseFlow handler type=java:com.jambit.axis.handlers.ContentCryptoHandler/ /responseFlow parameter name=qs:list value=org.apache.axis.transport.http.QSListHandler/ parameter name=qs:wsdl value=org.apache.axis.transport.http.QSWSDLHandler/ parameter name=qs.list value=org.apache.axis.transport.http.QSListHandler/ parameter name=qs.method value=org.apache.axis.transport.http.QSMethodHandler/ parameter name=qs:method value=org.apache.axis.transport.http.QSMethodHandler/ parameter name=qs.wsdl value=org.apache.axis.transport.http.QSWSDLHandler/ /transport transport name=local responseFlow handler type=LocalResponder/ /responseFlow /transport /deployment
RE: How can I set handlers for clients
Hi, The client's deployment descriptor client_config.wsdd can also be used with the stubs generated by WSDL2Java. For more information, check the Axis Wiki: http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration Tony -Message d'origine- De : Dacheng [mailto:[EMAIL PROTECTED] Envoyé : jeudi 17 novembre 2005 12:24 À : axis-user@ws.apache.org Objet : How can I set handlers for clients Hi, I am new in Axis and just meet a problem. How to set handers at the client side? when I use call.invoke() to invoke a service, I can use client-config.wsdd to set handlers. But at the moment I have to use stubs, what should I do? Hope I can get assistance for u. Thank you in advance Dacheng
RE: How can I insert a Handler in the server side just AFTER the transport?
Robert, You just have to insert your handlers in the /deployment/transport elements of your server-config.wsdd: Here what it looks like: transport name=http ... requestFlow handler type=URLMapper/ handler type=java:org.apache.axis.handlers.http.HTTPAuthHandler/ *YOUR HANDLER(S)* /requestFlow responseFlow *YOUR HANDLER(S)* /responseFlow /transport Regards, Tony -Message d'origine- De : news [mailto:[EMAIL PROTECTED] De la part de Robert Simmons Jr. Envoyé : mardi 8 novembre 2005 15:22 À : axis-user@ws.apache.org Objet : How can I insert a Handler in the server side just AFTER the transport? Greetings, I have a web service that uses AXIS and I want to implement a server side handler that will digitally sign transactions with a certificate as they go out over the wire and check signatures as they come in. The handler will operate on the raw body of the http content (not the headers) and embed the signature into the headers. I can write such a handler easy enough but I dont know how I can insert it into the server side chain. Can anyone help me with that? -- Robert
RE: Re: How can I insert a Handler in the server side just AFTER the transport?
Robert, Instances of handlers are created by the Axis engine. You shouldn't need to manipulate them in your implementation code. To exchange data with a handler, use the class org.apache.axis.MessageContext instead. More information can be found in the Axis Architecture Guide: http://ws.apache.org/axis/java/architecture-guide.html Regards, -- Tony -Message d'origine- De : news [mailto:[EMAIL PROTECTED] De la part de Robert Simmons Jr. Envoyé : mardi 8 novembre 2005 16:08 À : axis-user@ws.apache.org Objet : Re: How can I insert a Handler in the server side just AFTER the transport? Thanks a bunch. How would I get access to that handler later (for setting config and stuff like that) ? Should I just save a static instance in it or something? -- Robert zze-ELSOKHON Tony RD-BIZZ-ISS schrieb: Robert, You just have to insert your handlers in the /deployment/transport elements of your server-config.wsdd: Here what it looks like: transport name=http ... requestFlow handler type=URLMapper/ handler type=java:org.apache.axis.handlers.http.HTTPAuthHandler/ *YOUR HANDLER(S)* /requestFlow responseFlow *YOUR HANDLER(S)* /responseFlow /transport Regards, Tony -Message d'origine- De : news [mailto:[EMAIL PROTECTED] De la part de Robert Simmons Jr. Envoyé : mardi 8 novembre 2005 15:22 À : axis-user@ws.apache.org Objet : How can I insert a Handler in the server side just AFTER the transport? Greetings, I have a web service that uses AXIS and I want to implement a server side handler that will digitally sign transactions with a certificate as they go out over the wire and check signatures as they come in. The handler will operate on the raw body of the http content (not the headers) and embed the signature into the headers. I can write such a handler easy enough but I dont know how I can insert it into the server side chain. Can anyone help me with that? -- Robert
RE: Axis 1.2 handlers
Check this page in the Axis Wiki: http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration -Message d'origine- De : Coyne, Jimmy [mailto:[EMAIL PROTECTED] Envoyé : mardi 18 octobre 2005 18:45 À : 'axis-user@ws.apache.org' Objet : Axis 1.2 handlers Hi all, Could any body show me some information on how to configure handlers on the axis client side ? Did a search on google , but came up with nothing . Thanks Jimmy
RE: HTTP Basic Auth on wsdl-generated stubs?
Hi, I once had to deal with this problem, and I figured it out by looking at the stub's code generated by WSDL2Java: In your example, you should find the method: protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException in the class ChargeSoapBindingStub.java. This method is used by the higher-level stub to create the Call instance. In this method, you should find the following: java.util.Enumeration keys = super.cachedProperties.keys(); while (keys.hasMoreElements()) { java.lang.String key = (java.lang.String) keys.nextElement(); _call.setProperty(key, super.cachedProperties.get(key)); } This means that each time a Call instance is created, it receives all the properties of the higher-level stub. In your high-level client code, you may use: Stub s = (Stub)service.getCharge(); s.setProperty(Call.USERNAME_PROPERTY, username); s.setProperty(Call.PASSWORD_PROPERTY, password); Regards, Tony -Message d'origine- De : Bas A. Schulte [mailto:[EMAIL PROTECTED] Envoyé : samedi 15 octobre 2005 01:58 À : axis-user@ws.apache.org Objet : HTTP Basic Auth on wsdl-generated stubs? Hi, if I call my webservice with wsdl2java generated classes, like so: ChargeService service = new ChargeServiceLocator(); Charge i = service.getCharge(); ChargeResponse result = i.charge(testMIN, transactionId, null, (float)1.2, item); how can I stick in http basic auth headers? If I create a lowlevel Call instance etc., I can do that like this: call.setProperty(Call.USERNAME_PROPERTY, username); call.setProperty(Call.PASSWORD_PROPERTY, password); but I can't figure out how to get at the Call instance when using the higher-level stubs. Thanks, Bas.
RE: Web service constructor call
Hi Philippe, I don't know if Axis creates instances of WS classes when the web services are deployed. Maybe it creates an instance after it receives the first client request. An instance of a WS class may serve one or many client requests. I guess you want your service to execute some code prior to any client invocation. The proper way to do it is to put a handler in the server's request chain that executes the required code upon the first client call. Regards, Tony ELSOKHON -Message d'origine- De : GIBERT Philippe RD-BIZZ-SOP [mailto:[EMAIL PROTECTED] Envoyé : lundi 17 octobre 2005 17:42 À : axis-user@ws.apache.org Objet : Web service constructor call Hi, my Environment : Axis 1.2 + tomcat 5.0 on linux I would like to have A web service constructor to be called when axis/tomcat starts without any web service client call? Is this possible ? I have not found any clue in the wsdd file documentation Or at the wsdd reference site http://www.osmoticweb.com/axis-wsdd/ philippe
RE: finding client-config.wsdd icw WebStart
John, You can still try using an XMLStringProvider. It should work if you figure out the possible encoding problems. You can also include a client-config.wsdd file in one of the jars that are on the classpath. Axis is able to retrieve it there. Even better, you can build programmatically a customized Axis configuration engine by implementing the interface org.apache.axis.EngineConfiguration. You can find some sample code here: http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration Regards, Tony ELSOKHON -Message d'origine- De : Johan Walters [mailto:[EMAIL PROTECTED] Envoyé : mardi 11 octobre 2005 14:18 À : axis-user@ws.apache.org Objet : finding client-config.wsdd icw WebStart I'm having a strange problem I cannot figure out. I am using Axis 1.2. Currently, I have a working webstart application that uses axis. It is able to communicate succesfully to my server using soap. Now I would like to implement soap-header based sessions. In order to do that, I have to supply a client-config.wsdd file to the client. There are 4 ways to to this: 1) Put the client-config.wsdd file in the working directory. Since webstart only uses weird cache directories, this is no option. 2) Put the client-config.wsdd file in the classpath. There is no option for inlcuding new directories to the classpath once webstart (and thus the VM) is running, right? So no-go here either. 3) Put the client-config.wsdd file somewhere you like and put the parent directory of the file in a system property called axis.ClientConfigFile. This gives me the following error (just the first few lines): org.apache.axis.InternalException: org.apache.axis.ConfigurationException: org.apache.axis.ConfigurationException: No engine configuration file - aborting! org.apache.axis.ConfigurationException: No engine configuration file - abor= ting! at org.apache.axis.configuration.FileProvider.configureEngine(FileP= rovider.java:175) at org.apache.axis.AxisEngine.init(AxisEngine.java:172) at org.apache.axis.AxisEngine.init(AxisEngine.java:156) at org.apache.axis.client.AxisClient.init(AxisClient.java:52) at org.apache.axis.client.Service.getAxisClient(Service.java:103) at org.apache.axis.client.Service.init(Service.java:112) at client.JarDistributionServiceLocator.init ... ... Somehow, the FileProvider failed to load the file. 4) I created a FileProvider myself, and even tried a XMLStringProvider like this: XP =3D new XMLStringProvider(StringContainingClientConfigWSDD) ... locator =3D new JarDistributionServiceLocator(); XP.configureEngine(locator.getEngine()); Both the FileProvider and XMLStringProvider give the following error: org.apache.axis.InternalException: org.apache.axis.ConfigurationException: org.xml.sax.SAXException: Fatal Error: URI=3Dnull Line=3D-1: Premature end of file. org.xml.sax.SAXException: Fatal Error: URI=3Dnull Line=3D-1: Premature end = of file. at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError (XMLUtils.java:723) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fata= lError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportE= rror(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportE= rror(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.deter= mineDocVersion(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.pa= rse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.pa= rse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unkno= wn Source) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unkno= wn Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.pars= e(Unknown Source) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369) at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388) at org.apache.axis.configuration.FileProvider.configureEngine(FileP= rovider.java:179) at org.apache.axis.AxisEngine.init(AxisEngine.java:172) at org.apache.axis.AxisEngine.init(AxisEngine.java:156) at org.apache.axis.client.AxisClient.init(AxisClient.java:52) at org.apache.axis.client.Service.getAxisClient(Service.java:103) at org.apache.axis.client.Service.init(Service.java:112) at client.JarDistributionServiceLocator.init(JarDistributionServi= ceLocator.java:12) at client.GridClassLoader.init(GridClassLoader.java:81) at client.GridClassLoader.init(GridClassLoader.java:51) at client.Client.main(Client.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
RE: finding client-config.wsdd icw WebStart
Johan; When you create a customized EngineConfiguration, Axis uses it directly to configure the client-side engine and stops looking for a client-config.wsdd file. Tony -Message d'origine- De : Johan Walters [mailto:[EMAIL PROTECTED] Envoyé : mardi 11 octobre 2005 16:57 À : axis-user@ws.apache.org Objet : Re: finding client-config.wsdd icw WebStart Thank you, after trying creating a EngineConfiguration myself I don't get errors anymore so I think the client-config.wsdd file is found. The problem still is, the handlers that are supposed to return SOAP headers with the session ID still do not work. It might even well be the case that my client already found client-config.wsdd before, but I just assumed it didn't because no SOAP session headers appear. Every message from the server does contain a soap header with a new session ID, the client does not include any soap header at all as it should have. So the server keeps sending new ID's every time. Perhaps any ideas why SimpleSessionHandler fails at my client side? Johan Walters 2005/10/11, zze-ELSOKHON Tony RD-BIZZ-ISS [EMAIL PROTECTED]: John, You can still try using an XMLStringProvider. It should work if you figure out the possible encoding problems. You can also include a client-config.wsdd file in one of the jars that are on the classpath. Axis is able to retrieve it there. Even better, you can build programmatically a customized Axis configuration engine by implementing the interface org.apache.axis.EngineConfiguration. You can find some sample code here: http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration Regards, Tony ELSOKHON -Message d'origine- De: Johan Walters [mailto:[EMAIL PROTECTED] Envoyé: mardi 11 octobre 2005 14:18 À: axis-user@ws.apache.org Objet: finding client-config.wsdd icw WebStart I'm having a strange problem I cannot figure out. I am using Axis 1.2. Currently, I have a working webstart application that uses axis. It is able to communicate succesfully to my server using soap. Now I would like to implement soap-header based sessions. In order to do that, I have to supply a client-config.wsdd file to the client. There are 4 ways to to this: 1) Put the client-config.wsdd file in the working directory. Since webstart only uses weird cache directories, this is no option. 2) Put the client-config.wsdd file in the classpath. There is no option for inlcuding new directories to the classpath once webstart (and thus the VM) is running, right? So no-go here either. 3) Put the client-config.wsdd file somewhere you like and put the parent directory of the file in a system property called axis.ClientConfigFile. This gives me the following error (just the first few lines): org.apache.axis.InternalException: org.apache.axis.ConfigurationException: org.apache.axis.ConfigurationException: No engine configuration file - aborting! org.apache.axis.ConfigurationException: No engine configuration file - abor= ting! at org.apache.axis.configuration.FileProvider.configureEngine(FileP= rovider.java:175) at org.apache.axis.AxisEngine.init(AxisEngine.java:172) at org.apache.axis.AxisEngine.init(AxisEngine.java:156) at org.apache.axis.client.AxisClient.init(AxisClient.java:52) at org.apache.axis.client.Service.getAxisClient(Service.java:103) at org.apache.axis.client.Service.init(Service.java:112) at client.JarDistributionServiceLocator.init ... ... Somehow, the FileProvider failed to load the file. 4) I created a FileProvider myself, and even tried a XMLStringProvider like this: XP =3D new XMLStringProvider(StringContainingClientConfigWSDD) ... locator =3D new JarDistributionServiceLocator(); XP.configureEngine(locator.getEngine()); Both the FileProvider and XMLStringProvider give the following error: org.apache.axis.InternalException: org.apache.axis.ConfigurationException: org.xml.sax.SAXException: Fatal Error: URI=3Dnull Line=3D-1: Premature end of file. org.xml.sax.SAXException: Fatal Error: URI=3Dnull Line=3D-1: Premature end = of file. at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError (XMLUtils.java:723) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fata= lError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportE= rror(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportE= rror(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.deter= mineDocVersion(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.pa= rse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.pa= rse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unkno= wn Source) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unkno= wn
How to get the client stub in my handler code ?
Hi, Is there a way to get, in a client-side handler's code, a reference to the org.apache.axis.client.Stub instance that was used to make the request ? Thanks, -- Tony
[Axis2] Dynamic Handler Chain
Hello, Do you have any articles or tutorials about dynamic handler chains through module engagement in Axis2 ? Jayasinghe's Axis2 Execution Framework states that WS-Policy handlers can engage a module at the runtime by considering message headers. Any complementary information ? Thanks, -- Tony ELSOKHON
RE: classCastError after deploy a customized handler
You should try to extend the class BasicHandler from org.apache.axis.handlers instead of GenericHandler from JAX-RPC. BasicHandler is the base class of all the handlers built-in with Axis. You may replace the GenericHandlers methods handleRequest and handleResponse with BasicHandlers invoke. De: Feng Xie (fxie) [mailto:[EMAIL PROTECTED] Envoy: mardi 30 aot 2005 23:28 : axis-user@ws.apache.org Objet: classCastError after deploy a customized handler I developed a customized handler which extends GenericHandler and implemented it to log soap request message, its complete code is like : public class SoapMsgLogHandler extends GenericHandler { private Logger soapLogger = null; public void init(HandlerInfo config) { soapLogger = SubscriberDataMgrBindingImpl.baseContext.getCtxLog(); } public QName[] getHeaders() { return new QName[0]; } private boolean logMessage(MessageContext context, OutputStream out) { if ((soapLogger != null) (soapLogger.getLevel().toInt() = Level.DEBUG.toInt())) { SOAPMessageContext smg = (SOAPMessageContext) context; try { smg.getMessage().writeTo(out); soapLogger.debug(out.toString()); } catch (Exception e) {} return true; } else return false; } public boolean handleRequest(MessageContext context) { return logMessage(context,System.out); } public boolean handleResponse(MessageContext context) { return logMessage(context,System.out); } } Iadd it into the requestFlow of one service, I did deploy it. However, while I was to invoke that service, I got SoapFault which indicates following error faultString: org.apache.axis.ConfigurationException: java.lang.ClassCastException java.lang.ClassCastException at org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:302) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) at org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain.java:125) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) at org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:422) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) at org.apache.axis.deployment.wsdd.WSDDDeployment.getService(WSDDDeployment.java:460) at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:231) at org.apache.axis.AxisEngine.getService(AxisEngine.java:311) at org.apache.axis.MessageContext.setTargetService(MessageContext.java:755) at org.apache.axis.handlers.http.URLMapper.invoke(URLMapper.java:50) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:239) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:697) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at
Lifetime of a handler instance
Hi, I noticed that when using handlers on an Axis server or client, instances of handlers are created upon the first request/response chain that invokes them and stay alive until the application ends or the server shuts down. The same instance of the handler will be invoked in later processing chains. Is there any way to modify this default behaviour? It would be convenient for my client application to have a new handler for every request or response... Thanks, -- Tony ELSOKHON
RE: Modify SOAP Headers for Authentication
Jonathan, Using the MessageContext to retreive/set SOAP headers is the right way to do things. Here's how I do things in my code: 1 - Retreiving a SOAP Header Element from the SOAP message -- // Current SOAP request Message inMessage = msgContext.getRequestMessage(); // SOAP Message envelope SOAPEnvelope envelope = inMessage.getSOAPEnvelope(); // Retreiving a header element // SOAPHeaderElement header = envelope.getHeaderByName(__STR_NAMESPACE_URI__, __STR_LOCALPART__); In your code, there's no trace of a SOAPEnvelope object... 2 - Setting a new SOAP Header Element in the response -- Here again, you must use the envelope of the SOAP message // Current SOAP Response Message outMessage = msgContext.getResponseMessage(); // SOAP Message envelope SOAPEnvelope enveloppe = outMessage.getSOAPEnvelope(); // First create a SOAP Header Element SOAPHeaderElement headerRoot = new SOAPHeaderElement(__STR_NAMESPACE_URI__, __STR_LOCALPART__); // Insert the required element in headerRoot headerRoot.addChildElement(...); // Insert headerRoot in the message envelope enveloppe.addHeader(headerRoot); // Last, and here's the trick, create a NEW output message // with the new modified envelope in order for the changes to // take effect. msgContext.setResponseMessage(new Message(envelope)); Enjoy Axis, -- Tony ELSOKHON France Telecom RD/bizz/cil -Message d'origine- De : Jonathan J. Vargas R. [mailto:[EMAIL PROTECTED] Envoyé : jeudi 18 août 2005 00:49 À : axis-user@ws.apache.org Objet : Modify SOAP Headers for Authentication Greets, I want to get and set the SOAP Headers for the messages transmited to and from my webservice. I saw I was able to retrieve SOAP request and response messages from MessageContext, though, after I save headers they are not really seen in the response message so i wondered if this was the right procedure or it should be done in another way? I want to work authentication through SOAP Headers, and this is the trivial web service implementation class that I am using: -- public class AuthImpl { public boolean authenticate (String username, String password) throws AuthServiceException { boolean isValidUser = false; try { MessageContext mc = MessageContext.getCurrentContext (); SOAPMessage req_message = mc.getRequestMessage (); SOAPHeader sh = req_message.getSOAPHeader (); // here how can i retrieve the SOAP Header element named AuthRequest ? // ... // and then i compare its elements against my user's data base // ... // and then set isValidUser to true if found.. } catch (SOAPException se) { // ... } if (!isValidUser) { throw new AuthServiceException ( Authentication failed for supplied credentials); } try { MessageContext mc = MessageContext.getCurrentContext (); SOAPMessage resp_message = mc.getResponseMessage (); SOAPHeader sh = resp_message.getSOAPHeader (); // and here examine SOAP header element named AuthResponse and // set username, userid and those values retrieved from database // to proper Soap header elements to be returned to caller.. how ? } catch (SOAPException se) { // ... } // set this object values with user info extracted from data base.. // and then return it.. return isValidUser; } --- -- Jonathan J. Vargas Rodriguez [EMAIL PROTECTED] Conservar el silencio interior cuando vuelo en la tormenta me es mejor, porque asi ya no soy otra gota de la tempestad
RE: RES: Error - java.lang.reflect.InvocationTargetException?
Javier, Where I have to put the class? I putted it into [TOMCAT]webapps\axis\WEB-INF\classes and didn't work. Could you be more clear please!?! Thanks a lot! Fabrício Fabricio, The Java 1.4.2 API documentation says: InvocationTargetException is a checked exception that wraps an exception thrown by an invoked method or constructor. [...] The target exception that is provided at construction time [...] may be accessed via the Throwable.getCause() method. So the JVM's class loader actually finds the classes used by the service implementation. If you catch the exception and print the stack trace of its cause, you will be able to find what Exception was thrown by the secondary classes used by the service. -Mensagem original- De: Javier Gonzalez [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 16 de agosto de 2005 18:34 Para: axis-user@ws.apache.org Assunto: Re: RES: Error - java.lang.reflect.InvocationTargetException? I'm not sure I'm understanding you two - calling all sorts of Java classes is possible with axis. Are you sure you have all the needed classes in the webapp classpath? Does your class need special parameters for its constructor? On 8/16/05, Fabrício [EMAIL PROTECTED] wrote: Hi Donald, In my case, I really need to have the call to method from another class. My web service is a kind of wrapper for a legacy application. And to do the call, it's necessary to escort stdin and stderr. And I'm doing this with two threads. As: cmd = d:\\programs\\cap3\\cap3 + newPath + my_seqs; process = Runtime.getRuntime().exec(cmd); StringBuffer inBuffer = new StringBuffer(); InputStream inStream = processo.getInputStream(); new InputStreamHandler( inBuffer, inStream ); StringBuffer errBuffer = new StringBuffer(); InputStream errStream = processo.getErrorStream(); new InputStreamHandler( errBuffer , errStream ); process.waitFor(); The InputStreamHandler is another java class. I really don't know how to solve it without the use of these threads (another class). :'-( -- Fabrício. -Mensagem original- De: Chen, Donald [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 16 de agosto de 2005 16:14 Para: [EMAIL PROTECTED]; axis-user@ws.apache.org Assunto: RE: Error - java.lang.reflect.InvocationTargetException? Yes, exactly. The moment I let the method in the WS call another class, I got the problem. Looks like we are on the same boat. Right now, I am trying to rewrite the service provider class to avoid the unnecessary calling. Also, I suspect the Tomcat is not able to find all the necessary jars to facilitating the call. Let me know what's your finding? Don -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 1:31 PM To: axis-user@ws.apache.org; Chen, Donald Subject: Re: Error - java.lang.reflect.InvocationTargetException? Hi, I'm having the same problem and in my case is because my web service needs to call a method from a common java class. I need to do this, but I think that isn't possible in Axis. Does your web service has a method call to another class to? -- Fabricio. Citando Chen, Donald [EMAIL PROTECTED]: Hi, there. I got a Error - java.lang.reflect.InvocationTargetException complain when I tried to invoke a web service. Any idea on how to find out what's going wrong? And what could be the reason(s)? Thanks. Don PS. Configure: WinXPPro Tomcat5.5/Axis1.2/JRE1.5 This message was sent using IMP, the Internet Messaging Program. -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.10/73 - Release Date: 15/8/2005 -- Javier Gonzalez Nicolini -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.10/73 - Release Date: 15/8/2005
RE: adding elements to soap message?
I think I might need to add the element at a specific place in the soap xml. However, I can't find a method to insert a child element of a soapelement in a specific location in the javadocs. Any help please? In my own code, I use the class MessageElement instead of the interface SOAPElement. The code: QName element = new QName(__SOME_NAMESPACE_URI__, __SOME_NAME__); XXX.addChildElement(new MessageElement(element, Text node value)); works fine. On 8/12/05, Javier Gonzalez [EMAIL PROTECTED] wrote: Hi! I receive soap messages via a document axis webservice, and I'm trying to add an optional node to the soap message before relaying it to some other place for further processing. I'm trying this: SOAPElement attachid = ParentNodeOfOptional.addChildElement(NameOfOptionalNode); attachid.addTextNode(ValueOfOptionalNode); But when I print ParentNodeOfOptional.toString() the optional node isn't added. What am I doing wrong? Thanks in advance. -- Javier Gonzalez Nicolini -- Tony ELSOKHON