Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 54839 invoked by uid 500); 10 Sep 2002 15:19:35 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 54824 invoked from network); 10 Sep 2002 15:19:35 -0000 Message-ID: <20020910151936.20125.qmail@web12803.mail.yahoo.com> Date: Tue, 10 Sep 2002 08:19:36 -0700 (PDT) From: Davanum Srinivas Reply-To: dims@yahoo.com Subject: RE: SOAP Header, addHeader method To: axis-dev@xml.apache.org, "Agrawal, Anuj \(Anuj\)** CTR **" In-Reply-To: <20020910151111.46014.qmail@web12804.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Just use SOAPHeader's addChildElement(SOAPHeaderElement) instead of using (axis's)SOAPEnvelope's addHeader. Thanks, dims --- Davanum Srinivas wrote: > Please open a bugzilla bug (http://nagoya.apache.org/bugzilla) and post the code that fails > ASAP. > > Thanks, > dims > > --- "Agrawal, Anuj (Anuj)** CTR **" wrote: > > Jean-Marc - > > > > We're facing the same problem. And we just tried latest build from 2002/09/09 per Davanum's > > suggestion, but it doesn't appear to have fixed the problem. :( > > > > Any luck on your end? > > Anyone else have a fix for this? > > We need this badly! :( (no pressure.. ;)) > > Thanks. > > Anuj. > > > > > -----Original Message----- > > > From: Jean-Marc Taillant [mailto:taillan2@bst.bsf.alcatel.fr] > > > Sent: Tuesday, September 10, 2002 8:32 AM > > > To: axis-dev@xml.apache.org; dims@yahoo.com > > > Subject: Re: SOAP Header, addHeader method > > > > > > > > > I will try the last build from 2002/09/09 > > > > > > > > > > > > ----- Original Message ----- > > > From: "Davanum Srinivas" > > > To: > > > Sent: Tuesday, September 10, 2002 2:22 PM > > > Subject: Re: SOAP Header, addHeader method > > > > > > > > > > Fixed. Please cross-check with latest nightly build. > > > > > > > > -- dims > > > > > > > > --- Jean-Marc Taillant wrote: > > > > > Hi, > > > > > I joined the mail from the mailing list about the > > > addHeader problem > > > > > > > > > > > > > ---------------------------------------------------------------------- > > > > > Ricky, > > > > > That helped quite a bit -- thanks. I tracked down the > > > problem. First, > > > the > > > > > reason I wasn't able to see the .addHeader method on the > > > SOAPEnvelope > > > object > > > > > is because the class I'm in (a holdover) imported > > > > > javax.xml.soap.SOAPEnvelope. So when I made a call to > > > > > SOAPEnvelope envelope = > > > msgContext.getRequestMessage().getSOAPEnvelope(); > > > > > > > > > > It was really returning a javax.xml.soap.SOAPEnvelope > > > object not an > > > > > org.apache.axis.message.SOAPEnvelope. I didn't have to > > > cast it, nor did > > > I > > > > > get compile time errors because the Axis IMPL is a > > > subclass of the Sun > > > > > interface. As a result the method addHeader() wasn't found. > > > > > > > > > > So since I couldn't use addHeader(), the road I was going > > > down was to > > > call > > > > > addChildElement on the returned SOAPEnvelope object -- > > > which in this > > > case > > > > > was javax.xml.soap.SOAPEnvelope -- but the implementation > > > is actually in > > > the > > > > > parent class of org.apache.axis.message.SOAPEnvelope: > > > > > org.apache.axis.message.MessageElement. > > > > > > > > > > Now, I've looked through the source code for both the axis > > > MessageElement > > > > > object and the SOAPEnvelope object, and it seems like the code for > > > > > addChildElement is stubbed out. However, if I use the > > > addChildElement() > > > call > > > > > instead of the addHeader() call, the element is not > > > appended and my > > > > > modification doesn't take -- no error is thrown but the > > > SOAP request > > > isn't > > > > > changed. > > > > > > > > > > The bug here is that both the > > > org.apache.axis.message.SOAPHeader class > > > and > > > > > the org.apache.axis.message.SOAPBody class don't override the > > > > > addChildElement of their parent. If you look at the code > > > for both of > > > these > > > > > classes, you'll see that they have a addHeaderElement() and > > > addBodyElement() > > > > > respectively. SOAPEvenlope has a similar behavior. But > > > none of the 3 > > > > > sub-classes override the parent class's method so the > > > header, envelope > > > or > > > > > body is never really changed. > > > > > > > > > > The solution to this (bug?) is for the SOAPHeader, SOAPBody and > > > SOAPEnvelope > > > > > classes to override the addChildElement of the parent so that the > > > element > > > > > doesn't go in the generic "children" ArrayList in the > > > MessageElement > > > parent > > > > > class but get added to the nested "bodyElements" Vector > > > (in SOAPBody) > > > and > > > > > "headers" Vector (in SOAPHeader). I'd be happy to help the Axis > > > developers > > > > > with this change if necessary. > > > > > > > > > > Regards, > > > > > Rob > > > > > > > > > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: Ricky Ho [mailto:riho@cisco.com] > > > > > Sent: Friday, September 06, 2002 10:54 AM > > > > > To: axis-user@xml.apache.org > > > > > Subject: RE: Handlers and SOAP message re-writing > > > > > > > > > > > > > > > Following is my exact code based on AXIS beta 2 > > > > > > > > > > import org.apache.axis.*; > > > > > import org.apache.axis.handlers.*; > > > > > import org.apache.axis.message.*; > > > > > > > > > > public class PutHeaderHandler extends BasicHandler { > > > > > public void invoke(MessageContext msgContext) throws AxisFault > > > > > { > > > > > try { > > > > > System.out.println(" -- PutHeaderHandler > > > starts --"); > > > > > System.out.println("Options are : " + > > > getOptions()); > > > > > > > > > > SOAPEnvelope envelope = > > > > > msgContext.getRequestMessage().getSOAPEnvelope(); > > > > > System.out.println("Request message is : > > > " + envelope); > > > > > envelope.addHeader(new > > > SOAPHeaderElement("TestNameSpace", > > > > > "isAuthenticated", new Boolean(true))); > > > > > > > > > > System.out.println("Add header"); > > > > > } catch (Exception e) { > > > > > throw AxisFault.makeFault(e); > > > > > } > > > > > } > > > > > } > > > > > > > > > > Rgds, Ricky > > > > > ----------------------------------------- > > > > > > > > > > > > > > > > > ===== > > > > Davanum Srinivas - http://xml.apache.org/~dims/ > > > > > > > > __________________________________________________ > > > > Yahoo! - We Remember > > > > 9-11: A tribute to the more than 3,000 lives lost > > > > http://dir.remember.yahoo.com/tribute > > > > > > ===== > Davanum Srinivas - http://xml.apache.org/~dims/ > > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost > http://dir.remember.yahoo.com/tribute ===== Davanum Srinivas - http://xml.apache.org/~dims/ __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute