axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject RE: SOAP Header, addHeader method
Date Tue, 10 Sep 2002 15:19:36 GMT
Just use SOAPHeader's addChildElement(SOAPHeaderElement) instead of using (axis's)SOAPEnvelope's
addHeader.

Thanks,
dims

--- Davanum Srinivas <dims@yahoo.com> wrote:
> Please open a bugzilla bug (http://nagoya.apache.org/bugzilla) and post the code that
fails
> ASAP.
> 
> Thanks,
> dims
> 
> --- "Agrawal, Anuj (Anuj)** CTR **" <agrawal@lucent.com> 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" <dims@yahoo.com>
> > > To: <axis-dev@xml.apache.org>
> > > 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 <taillan2@bst.bsf.alcatel.fr> 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

Mime
View raw message