Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 10755 invoked from network); 21 Apr 2005 18:13:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Apr 2005 18:13:57 -0000 Received: (qmail 70926 invoked by uid 500); 21 Apr 2005 18:13:50 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 70742 invoked by uid 500); 21 Apr 2005 18:13:49 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 70651 invoked by uid 99); 21 Apr 2005 18:13:48 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of wsdeveloper@gmail.com designates 64.233.162.207 as permitted sender) Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.207) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 21 Apr 2005 11:13:47 -0700 Received: by zproxy.gmail.com with SMTP id 34so975129nzf for ; Thu, 21 Apr 2005 11:13:24 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WDdF/hmJcIRyIs4TmIA7zczh2F/1SI54pQMCyNUd/goy6PB0Dtbxlu2GilUZBgEHCCnuFr+SU7DV+7K6N1pR92XICaUgnDnX2CwqnwR+qiVnzBY3+3NsF5XaTJmqGBEctNvxlXX+K8VhsSWTVQkRsbeUa3/TfMa8E2RZ61ZL4XY= Received: by 10.36.9.18 with SMTP id 18mr217715nzi; Thu, 21 Apr 2005 11:13:24 -0700 (PDT) Received: by 10.36.18.18 with HTTP; Thu, 21 Apr 2005 11:13:24 -0700 (PDT) Message-ID: <3af54cdf050421111365968359@mail.gmail.com> Date: Thu, 21 Apr 2005 20:13:24 +0200 From: Mik Goodhelp Reply-To: Mik Goodhelp To: axis-user@ws.apache.org Subject: Re: How to pass information between handlers and services. In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <16a7541d0504210634422ce566@mail.gmail.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N The idea is that to pass information to an handler from the client-Applicat= ion in such way that all subsequent service invocations will be intercepted, then Information will be added into the SOAPHeader=20 and deliverd to different provider-services It should like really like the following: { // one time passing the info to an Handler in the General chain PassInformationToHandler( Info ); Service serice_1=3Dnew Service(); Service serice_2=3Dnew Service(); Service serice_3=3Dnew Service(); // Calls Call call_1 =3D (Call) service_1.createCall(); Call call_2 =3D (Call) service_1.createCall(); ........... call_1.invoke(...) call_2.invoke(...) call_3.invoke(...) } ////////////////////////// i don't want to do something like the following= : { ........... // Calls Call call_1 =3D (Call) service_1.createCall(); Call call_2 =3D (Call) service_1.createCall(); ........... MessageContext messageContext_1 =3D call_1.getMessageContext() ; MessageContext messageContext_2 =3D call_2.getMessageContext() ; MessageContext messageContext_3 =3D call_3.getMessageContext() ; messageContext_1.setProperty("MyInfo", Info ); messageContext_2.setProperty("MyInfo", Info ); messageContext_3.setProperty("MyInfo", Info ); call_1.invoke(...) call_2.invoke(...) call_3.invoke(...) } I was thinking at two ways to solve this problem=20 1) Making use of the singleton pattern.=20 Exchanging information saving it into a singleton object, and sharing it. 2) Dynamically attaching an Handler to all the Services,=20 passing the information each time the handler is attached (configured). But this dynamic configuration works per service but i did'nt manage to attach an Handler to all the services. Any other idea ? Thanks for the previous responses :) =20 =20 =20 On 4/21/05, mmalinos@aessuccess.org wrote: > You can pass information in the MessageContext itself using >=20 > the MessageContext.setProperty(String, Object) in the handler and then > using > the MessageContext.getProperty(String) in the Service or Client. >=20 > // Example Handler Code > public void invoke(MessageContext msgContext) throws AxisFault > { > System.out.println("Inside Handler"); > msgContext.setProperty("SomeReference", "Some Text if String")= ; > // Could be any object not just string > } >=20 > // Example Service Code >=20 > MessageContext ctx =3D MessageContext.getCurrentContext(); > String SomeReference =3D (String) ctx.getProperty("SomeReference"); >=20 > System.out.println("SomeReference =3D " + SomeReference); // You > should get 'Some Text if String' >=20 > I've only tested this server side, but it should work client side as well= . > Hope this helps, > Mark A. Malinoski > AES/PHEAA > Technical Coordinator/Web Development > 717-720-2413 > mmalinos@aessuccess.org >=20 > Robert Gombotz > mail.com> To > axis-user@ws.apache.org, Mik > 04/21/2005 09:34 Goodhelp > AM cc >=20 > Subject > Please respond to Re: How to pass information between > axis-user@ws.apac handlers and services. > he.org >=20 >=20 > as far as I know there is no way for a handler to talk to a WS > directly. but you can get the message inside your WS implementation: >=20 > in your WS you can get the soap message using > org.apache.axis.MessageContext.getCurrentContext() which gives you an > object of type MessageContext. that you can use just like in your > handlers, so just retrieve any info fram the message you want. >=20 > hope I could be of help. >=20 > Rob >=20 > On 4/21/05, Mik Goodhelp wrote: > > I am trying to implement an application that does the following. > > Assume we have a client : > > > > startSomething(XMLFLAG) > > call.invoke(EndpointReference_1) > > call.invoke(EndpointReference_2) > > call.invoke(EndpointReference_3) > > > > An Handler has to intercept the different calls and put the XMLFLAG in > > the SOAPHeader of all the calls. > > > > On the Provider side an Handler has to intercept the call, get the > > XMLFLAG from the SOAPHeader and pass it to the provider service. > > > > In simple words there is a way to directly pass information between > > Client-Services and Client-Handlers and between Provider-Handlers and > > Provider-Services > > ??? > > Thanks in advance. > > >=20 >