Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 2575 invoked from network); 14 May 2009 15:16:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 May 2009 15:16:50 -0000 Received: (qmail 62164 invoked by uid 500); 14 May 2009 15:16:49 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 62064 invoked by uid 500); 14 May 2009 15:16:49 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 62055 invoked by uid 99); 14 May 2009 15:16:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 May 2009 15:16:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 May 2009 15:16:38 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1M4cfS-0006iu-0h for axis-dev@ws.apache.org; Thu, 14 May 2009 08:16:18 -0700 Message-ID: <23542714.post@talk.nabble.com> Date: Thu, 14 May 2009 08:16:18 -0700 (PDT) From: Senthil Sona To: axis-dev@ws.apache.org Subject: Re: How to terminate InFlow and start OutFlow in the custom handler of axis2 In-Reply-To: <60708f4b0905140718y6a04f84fmd132d5546340e411@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: swsoni@cisco.com References: <23521710.post@talk.nabble.com> <4A0AD1F6.4020708@gmail.com> <23523282.post@talk.nabble.com> <4A0ADEB5.3000402@gmail.com> <23523940.post@talk.nabble.com> <60708f4b0905132108g7e3abb86q16b1ea6e895cecc4@mail.gmail.com> <23534995.post@talk.nabble.com> <60708f4b0905140105i1bfb055el796f2b1aec614244@mail.gmail.com> <23539036.post@talk.nabble.com> <4A0C1D65.5070508@gmail.com> <23540933.post@talk.nabble.com> <60708f4b0905140718y6a04f84fmd132d5546340e411@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi Amila, If we dont engage the Rampart and Sandesha at client side. Then the functionality is working fine. Its terminating the inFlow and sending the outFaultFlow response. If we engage sandesha the problem we are getting is, sandesha is not getting acknowledge for the request thats why its sending the request again and again. And if we are engaging rampart, its giving unable to find token error. But engaging both the modules are mandatory for us. So could you please help how to resolve these sandesha and rampart related errors also. Thanks, Swapna Soni. Amila Suriarachchi wrote: > > On Thu, May 14, 2009 at 7:20 PM, Senthil Sona wrote: > >> >> Hi Deepal, >> >> I am having a if condition in my handler class. I have uploaded the >> handler class and client class to this forum. Could you please look in to >> those and let me me know if i am doing anything wrong? As i mentioned in >> my >> last reply i am getting "AxisFault error saying first element must >> contain >> localname Envelope but found html". > > > Can you check your response with a tcpmon. Then you can see the actual > problem. I think you send the message to wrong epr. > > > I want client should get fault response. >> Sandesha > > > I think it is better to test step by step. first test with out sandesa if > you get the correct error message without sandesha then you can sure about > it. Then try with sandesha. > > thanks, > Amila. > >> is also keep on sending the request because its not getting >> acknowledgement. >> Could you please have a webex session with us if possible. So that we >> can >> explain you our problem very clearly. I have been trying this >> functionality >> from past 20 days. Its consuming lot of time. Please hlep me out. >> In axis2.xml file also i am calling custom module phase first and then >> RMphase bothin INFlow and OutFaultFlow. >> >> Thanks, >> Swapna Soni. >> >> >> >> Deepal Jayasinghe-2 wrote: >> > >> > Hi, >> > >> > I think what Amila suggested is correct too (and easy as well), just >> > throw the exception from the handler then transport receiver will >> handle >> > the sending part. I think that is the easiest way. If you are using >> > same handler for both in-flow and in-fault flow then just have a "if" >> > condition and handle the logic. >> > >> > Deepal >> >> Hi Deepal/Amila, >> >> >> >> Could you please reply me, how to resolve this exception. This >> task >> >> is >> >> very urgent for me. >> >> >> >> Thanks, >> >> Swapna Soni. >> >> >> >> Amila Suriarachchi wrote: >> >> >> >>> On Thu, May 14, 2009 at 11:47 AM, Senthil Sona >> wrote: >> >>> >> >>> >> >>>> Hi Amila, >> >>>> >> >>>> I have set the written the below code in my custom module. >> >>>> >> >>>> public InvocationResponse invoke(MessageContext msgContext) >> >>>> throws >> >>>> AxisFault { >> >>>> if(msgContext.getFLOW()==1) >> >>>> { >> >>>> MessageContext faultContext = >> >>>> >> >>>> MessageContextBuilder.createFaultMessageContext(msgContext, new >> >>>> AxisFault("validation failed error", new QName("validation error", >> >>>> "wsa"))); >> >>>> AxisEngine.sendFault(faultContext); >> >>>> >> >>>> >> >>> here as I told you earlier try to throw the AxisFault() >> >>> >> >>> i.e throw new AxisFault("validation error"); >> >>> >> >>> then the fault sending part is done at the transport level. >> >>> >> >>> thanks, >> >>> Amila. >> >>> >> >>> >> >>>> } >> >>>> return InvocationResponse.ABORT; >> >>>> } >> >>>> >> >>>> But when running the client program i am getting error at client >> >>>> console >> >>>> like >> >>>> >> >>>> org.apache.axis2.AxisFault: The input stream for an incoming message >> is >> >>>> null. >> >>>> at >> >>>> >> >>>> >> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:72) >> >>>> at >> >>>> >> >>>> >> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:353) >> >>>> 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 >> >>>> >> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548) >> >>>> at >> >>>> >> org.apache.rahas.client.STSClient.requestSecurityToken(STSClient.java:127) >> >>>> at >> >>>> org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:486) >> >>>> at >> >>>> >> org.apache.rampart.util.RampartUtil.getSecConvToken(RampartUtil.java:396) >> >>>> at >> >>>> >> >>>> >> org.apache.rampart.builder.SymmetricBindingBuilder.initializeTokens(SymmetricBindingBuilder.java:670) >> >>>> >> >>>> For outFaultFlow i am calling same handler and wrote the code like >> >>>> >> >>>> if(msgContext.getFLOW()==4) { >> >>>> System.out.println("This is OutFaultFlow"); >> >>>> System.out.println(" >> >>>> messagecontext=="+msgContext.getEnvelope()); >> >>>> } >> >>>> So its printing the fault soap resonse >> >>>> >> >>>> > >>>> oapenv="http://www.w3.org/2003/05/soap-envelope >> >>>> ">> >>>> xm >> >>>> lns:axis2ns5="validation >> >>>> error">axis2ns5:wsa> >>>> nv:Value>> >>>> xml:lang="en-US">validatio >> >>>> n failed error> >>>> /> >> >>>> >> >>>> >> >>>> I want this response should be printed at client console. How can i >> do >> >>>> this, >> >>>> please help me. Its stopping our productivity. >> >>>> >> >>>> I have uploaded the Handler class and client class. Could you please >> >>>> have >> >>>> a >> >>>> webex session with us. So that we can show you our complete code and >> >>>> how >> >>>> the >> >>>> program is behaving when we run the client. It will help us to >> resolve >> >>>> the >> >>>> problem soon. >> >>>> >> >>>> Thanks, >> >>>> Swapna Soni. >> >>>> >> >>>> >> >>>> Amila Suriarachchi wrote: >> >>>> >> >>>>> On Wed, May 13, 2009 at 8:48 PM, Senthil Sona >> >>>>> wrote: >> >>>>> >> >>>>> >> >>>>>> Hi Deepal, >> >>>>>> >> >>>>>> I have added the code in the handler class like >> >>>>>> >> >>>>>> if(msgContext.getFLOW()==1) >> >>>>>> { >> >>>>>> logger.info("This is inFlow"); >> >>>>>> System.out.println("This is inFlow"); >> >>>>>> MessageContext faultContext = >> >>>>>> >> >>>>>> MessageContextBuilder.createFaultMessageContext(msgContext, new >> >>>>>> AxisFault("validation failed error", new QName("validation error", >> >>>>>> "wsa"))); >> >>>>>> AxisEngine.sendFault(faultContext); >> >>>>>> >> >>>>> it is bit difficult to answer your question without looking all >> your >> >>>>> >> >>>> code. >> >>>> >> >>>>> But try this. >> >>>>> >> >>>>> >> >>>>> if you want to send a soap fault to client side, throw an AxisFault >> >>>>> >> >>>> here. >> >>>> >> >>>>> When you throw an AxisFault it is caught at the transport level and >> it >> >>>>> sends >> >>>>> the fault message by calling to fault flow. >> >>>>> >> >>>>> if you want to send a normal soap message do this, >> >>>>> >> >>>>> MessageContext outMsgContext = >> >>>>> MessageContextBuilder.createOutMessageContext(msgContext); >> >>>>> AxisEngine.send(outMsgContext); >> >>>>> return InvocationResponse.ABORT >> >>>>> >> >>>>> here it is important to return InvocationResponse.ABORT to >> terminate >> >>>>> >> >>>> the >> >>>> >> >>>>> inFlow. >> >>>>> >> >>>>> thanks, >> >>>>> Amila. >> >>>>> >> >>>>> >> >>>>>> } >> >>>>>> >> >>>>>> I am using the same handler class for inflow and outfault flow >> thats >> >>>>>> >> >>>> why >> >>>> >> >>>>>> i >> >>>>>> am checking if(msgContext.getFLOW()==1). At client console i am >> >>>>>> >> >>>> getting >> >>>> >> >>>>>> error like >> >>>>>> >> >>>>>> org.apache.axis2.AxisFault: validation failed error >> >>>>>> 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 >> >>>>>> >> >>>>>> >> >>>> >> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548) >> >>>> >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>> >> org.apache.rahas.client.STSClient.requestSecurityToken(STSClient.java:127) >> >>>> >> >>>>>> at >> >>>>>> org.apache.rampart.util.RampartUtil.getToken(RampartUtil.java:486) >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>> >> org.apache.rampart.util.RampartUtil.getSecConvToken(RampartUtil.java:396) >> >>>> >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>>>> >> >>>> >> org.apache.rampart.builder.SymmetricBindingBuilder.initializeTokens(SymmetricBindingBuilder.java:670) >> >>>> >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>>>> >> >>>> >> org.apache.rampart.builder.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:73) >> >>>> >> >>>>>> at >> >>>>>> org.apache.rampart.MessageBuilder.build(MessageBuilder.java:128) >> >>>>>> at >> >>>>>> >> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64) >> >>>>>> at org.apache.axis2.engine.Phase.invoke(Phase.java:317) >> >>>>>> at >> >>>>>> >> >>>> org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264) >> >>>> >> >>>>>> at >> >>>>>> org.apache.axis2.engine.AxisEngine.resumeSend(AxisEngine.java:370) >> >>>>>> at >> >>>>>> >> org.apache.sandesha2.workers.SenderWorker.run(SenderWorker.java:287) >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>>>> >> >>>> >> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061) >> >>>> >> >>>>>> at >> >>>>>> >> >>>>>> >> >>>>>> >> >>>> >> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575) >> >>>> >> >>>>>> at java.lang.Thread.run(Thread.java:735) >> >>>>>> >> >>>>>> and its keep on executing the handler, Because i am able to see >> the >> >>>>>> >> >>>> log >> >>>> >> >>>>>> message i am printing in inflow if condition again and again. I am >> >>>>>> printing >> >>>>>> the message context in OutFaultFlow. i am getting the message like >> >>>>>> >> >>>>>> This is OutFaultFlow >> >>>>>> messagecontext==> >>>>>> >> >>>> encoding='utf-8'?>> >>>> >> >>>>>> xmlns:s >> >>>>>> oapenv="http://www.w3.org/2003/05/soap-envelope >> >>>>>> ">> >>>>>> xm >> >>>>>> lns:axis2ns5="validation >> >>>>>> error">axis2ns5:wsa> >>>>>> nv:Value>> >>>>>> xml:lang="en-US">validatio >> >>>>>> n failed error> >>>>>> /> >> >>>>>> >> >>>>>> >> >>>>>> Thanks, >> >>>>>> Swapna Soni. >> >>>>>> >> >>>>>> Deepal Jayasinghe-2 wrote: >> >>>>>> >> >>>>>>> Try this, >> >>>>>>> >> >>>>>>> MessageContext faultContext = >> >>>>>>> MessageContextBuilder.createFaultMessageContext(messageCtx, e); >> >>>>>>> AxisEngine.sendFault(faultContext); >> >>>>>>> >> >>>>>>> - Deepal >> >>>>>>> >> >>>>>>>> Hi Deepal, >> >>>>>>>> >> >>>>>>>> Thanks for your reply. If we set the >> >>>>>>>> >> >>>>>> AxisEngine.sendFault(msgContext) >> >>>>>> >> >>>>>>>> in >> >>>>>>>> inflow handler, it will execute the outFaultFlow but client >> program >> >>>>>>>> >> >>>>>> wotn >> >>>>>> >> >>>>>>>> get >> >>>>>>>> any response and we are getting org.apache.axis2.AxisFault: Read >> >>>>>>>> >> >>>> timed >> >>>> >> >>>>>>>> out >> >>>>>>>> exception. And its again and again executing the inflow handler. >> >>>>>>>> >> >>>> For >> >>>> >> >>>>>>>> testing >> >>>>>>>> purpose i have written >> >>>>>>>> if(msgContext.getFLOW()==1) >> >>>>>>>> { >> >>>>>>>> logger.info("This is inFlow"); >> >>>>>>>> } >> >>>>>>>> in the inFlowhandler class and its getting execute again and >> >>>>>>>> >> >>>> again. >> >>>> >> >>>>>> But >> >>>>>> >> >>>>>>>> i >> >>>>>>>> want it should get execute only once when request comes from >> client >> >>>>>>>> >> >>>>>> and >> >>>>>> >> >>>>>>>> it >> >>>>>>>> should do validation of that request message, if something is >> wrong >> >>>>>>>> >> >>>>>> then >> >>>>>> >> >>>>>>>> outflow or OutFaultFlow should get execute and send the proper >> >>>>>>>> >> >>>> error >> >>>> >> >>>>>>>> response to client and should get terminate there only. Once we >> get >> >>>>>>>> >> >>>>>> any >> >>>>>> >> >>>>>>>> validation error in inFlow handler, it should not process >> further >> >>>>>>>> >> >>>>>> engaged >> >>>>>> >> >>>>>>>> module and request should terminate in inFlow and from there >> client >> >>>>>>>> should >> >>>>>>>> get response via outFlow or outFaultFlow. >> >>>>>>>> >> >>>>>>>> We are engaging the sandesha and rampart from in the client >> >>>>>>>> >> >>>> program >> >>>> >> >>>>>>>> only. >> >>>>>>>> >> >>>>>>>> sender.engageModule("addressing"); >> >>>>>>>> sender.engageModule("sandesha2"); >> >>>>>>>> >> >>>>>>>> >> >>>>>> options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, >> >>>>>> >> >>>>>>>> "Yash_Seq"); >> >>>>>>>> sender.engageModule("rampart"); >> >>>>>>>> >> >>>>>>>> >> >>>>>>>> >> >>>>>> options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, >> >>>>>> >> >>>> >> loadPolicy("C:/WS-X/misc/20090427/WTPTestRM2Client/WebContent/WEB-INF/conf/policy.xml")); >> >>>> >> >>>>>>>> Could you please let us know how to achieve this functionality. >> >>>>>>>> >> >>>>>>>> Thanks, >> >>>>>>>> Swapna Soni. >> >>>>>>>> >> >>>>>>>> Deepal Jayasinghe-2 wrote: >> >>>>>>>> >> >>>>>>>> >> >>>>>>>>> Behavior will be different based on the dispatch status, but >> you >> >>>>>>>>> >> >>>> can >> >>>> >> >>>>>>>>> simply call. >> >>>>>>>>> >> >>>>>>>>> AxisEngine.sendFault(messageContext) >> >>>>>>>>> >> >>>>>>>>> Then it will send the fault >> >>>>>>>>> >> >>>>>>>>> - Deepal >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>>> Hi Axis Team, >> >>>>>>>>>> >> >>>>>>>>>> I have one very urgent requirement. One client program >> >>>>>>>>>> >> >>>> invokes >> >>>> >> >>>>>> the >> >>>>>> >> >>>>>>>>>> service in which sandesha, rampart and one custom module is >> >>>>>>>>>> >> >>>> engaged. >> >>>> >> >>>>>> In >> >>>>>> >> >>>>>>>>>> custom Inflow handler we do some validation. If something is >> >>>>>>>>>> >> >>>> wrong >> >>>> >> >>>>>> in >> >>>>>> >> >>>>>>>>>> that >> >>>>>>>>>> validation, then we want it to start the outFlow and send the >> >>>>>>>>>> >> >>>> custom >> >>>> >> >>>>>>>>>> response to client back without executing further engaged >> modules >> >>>>>>>>>> >> >>>>>> and >> >>>>>> >> >>>>>>>>>> without invoking service. >> >>>>>>>>>> >> >>>>>>>>>> Could anyone please tell me how can i do this using axis2 >> api. >> >>>>>>>>>> >> >>>>>> Its >> >>>>>> >> >>>>>>>>>> very >> >>>>>>>>>> very urgent requirement for us. >> >>>>>>>>>> >> >>>>>>>>>> Thanks, >> >>>>>>>>>> swapna soni >> >>>>>>>>>> >> >>>>>>>>>> >> >>>>>>>>>> >> >>>>>>>>> -- >> >>>>>>>>> Thank you! >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> http://blogs.deepal.org >> >>>>>>>>> http://deepal.org >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> >> >>>>>>>> >> >>>>>>> -- >> >>>>>>> Thank you! >> >>>>>>> >> >>>>>>> >> >>>>>>> http://blogs.deepal.org >> >>>>>>> http://deepal.org >> >>>>>>> >> >>>>>>> >> >>>>>>> >> >>>>>>> >> >>>>>> -- >> >>>>>> View this message in context: >> >>>>>> >> >>>>>> >> >>>> >> http://www.nabble.com/How-to-terminate-InFlow-and-start-OutFlow-in-the-custom-handler-of-axis2-tp23521710p23523940.html >> >>>> >> >>>>>> Sent from the Axis - Dev mailing list archive at Nabble.com. >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>> -- >> >>>>> Amila Suriarachchi >> >>>>> WSO2 Inc. >> >>>>> blog: http://amilachinthaka.blogspot.com/ >> >>>>> >> >>>>> >> >>>>> >> >>>> http://www.nabble.com/file/p23534995/LogHandler.java LogHandler.java >> >>>> http://www.nabble.com/file/p23534995/client.java client.java >> >>>> -- >> >>>> View this message in context: >> >>>> >> http://www.nabble.com/How-to-terminate-InFlow-and-start-OutFlow-in-the-custom-handler-of-axis2-tp23521710p23534995.html >> >>>> Sent from the Axis - Dev mailing list archive at Nabble.com. >> >>>> >> >>>> >> >>>> >> >>> -- >> >>> Amila Suriarachchi >> >>> WSO2 Inc. >> >>> blog: http://amilachinthaka.blogspot.com/ >> >>> >> >>> >> >>> >> >> >> >> >> > >> > >> > -- >> > Thank you! >> > >> > >> > http://blogs.deepal.org >> > http://deepal.org >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/How-to-terminate-InFlow-and-start-OutFlow-in-the-custom-handler-of-axis2-tp23521710p23540933.html >> Sent from the Axis - Dev mailing list archive at Nabble.com. >> >> > > > -- > Amila Suriarachchi > WSO2 Inc. > blog: http://amilachinthaka.blogspot.com/ > > -- View this message in context: http://www.nabble.com/How-to-terminate-InFlow-and-start-OutFlow-in-the-custom-handler-of-axis2-tp23521710p23542714.html Sent from the Axis - Dev mailing list archive at Nabble.com.