axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Dick <adrian.d...@uk.ibm.com>
Subject Re: Regarding createAttribute() in IHeaderBlock
Date Tue, 18 Jan 2005 13:15:26 GMT




Hi,

My take on this is:

- IAttribute* createAttribute(const AxisChar *localname,
      const AxisChar *namespaceURI, const AxisChar *value) = 0;

This method will create an attribute that uses the provided namespaceURI.
If the namespace has already been declared, it takes the existing prefix,
otherwise it adds the namespace and generates a prefix.

 - IAttribute* createAttribute(const AxisChar* localname,
      const AxisChar* prefix,
      const AxisChar* uri, const AxisChar* value) = 0;
This will behave in a similar manner, except it also checks for the prefix,
using the specified prefix if it's not found to be in use.   Presumably we
need to something useful if the prefix is in use for a different namespace
URI - do we have a sensible exception to throw in this case?

In both cases, if the specified namespace URI hasn't already been declared,
then it should be done as part of this method.

+1 to making this clear in the API documentation.

Adrian
_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)


Roshan Weerasuriya <roshan@opensource.lk> wrote on 18/01/2005 12:48:03:

> hi all,
>
> >   IAttribute* createAttribute(const AxisChar* localname,const
> >AxisChar* prefix,
> >                                const AxisChar* uri, const AxisChar*
> > value) = 0;
> >    In this API  if we pass  prefix  then  uri will be discarded. On
> > seeing this API any user will think that it will create a namespace
> > declaration.
> Actualy if we are going to check whether the use has not declared the
> namespace, then it is a small matter to even create the namespace
> declaration if user hasn't done it. Because the difficult part is not
> automaticlay declaring, but checking back in the element hierarchy.
>
> And also the whole thing is this as I see. When we process a SOAP what
> is important is not the prefix, but what is important is the
> corrosponding namespaceURI. (We had this discussion way back in last
> year.....) But since there is a requirement to also let the user specify
> the prefix OK, we will support that as well. So What I propose is to
> have a API like:
>
> > > - IAttribute* createAttribute(const AxisChar* localname,
> > > >         const AxisChar* prefix,
> > > >         const AxisChar* uri, const AxisChar* value) = 0;
> > > >
> > > >   - IAttribute* createAttribute(const AxisChar *localname,
> > > >         const AxisChar *namespaceURI, const AxisChar *value) = 0;
>
> And also as I mentioned earlier, we could declare the namespace
> automaticaly if user hasn't done so. We can mention this in the API
> comment. A user will have to obviously read the API comments before
> he/she use any method.
>
> I would appreciate any of your ideas.
>
> Roshan
>
> On Tue, 2005-01-18 at 17:42, James Jose wrote:
> > Hi,
> >
> >    IAttribute* createAttribute(const AxisChar* localname,const
> > AxisChar* prefix,
> >                                const AxisChar* uri, const AxisChar*
> > value) = 0;
> >    In this API  if we pass  prefix  then  uri will be discarded. On
> > seeing this API any user will think that it will create a namespace
> > declaration.
> >
> >   So what I feel it is better to have the two APIs
> >
> >   IAttribute* createAttribute(const AxisChar* localname,const
> > AxisChar* value)=0
> >   IAttribute* createAttribute(const AxisChar* localname,const
> > AxisChar* prefix,const AxisChar* value)=0
> >
> >  In the second type the user has to use createNamespaceDecl() API to
> > create the  namespace. Then he/she can use that prefix.
> >
> >
> > Regards
> > James
> > --------------------------------------------------
> > James Jose
> > Messaging Clients Team, WMQDDC
> > IBM Software Labs, India
> > Direct: 91-80- 25094331  Ext :2331
> > E-mail: jamejose@in.ibm.com
> >
> >
> >
> >
> > Roshan Weerasuriya
> > <roshan@opensource.lk>
> >
> > 18/01/2005 16:14
> >          Please respond to
> >   "Apache AXIS C Developers List"
> >                To
> > Apache AXIS C
> > Developers List
> > <axis-c-dev@ws.apache.org>
> >                cc
> >
> >           Subject
> > Re: Regarding
> > createAttribute()
> > in IHeaderBlock
> >
> >
> >
> >
> > hi Adrian,
> >
> > Sure. Shall we name the parameter as "namespaceURI", since it reflects
> > the purpose?
> >
> > Roshan
> >
> > On Tue, 2005-01-18 at 16:37, Adrian Dick wrote:
> > >
> > >
> > > Hi,
> > >
> > > Your proposal looks good to me.
> > >
> > > Just one comment,   can we make the parameter names consistent
> > across the
> > > methods.   I notice you've mixed uri and namespaceURI, it's a small
> > detail,
> > > but it may confuse users.
> > >
> > > Regards,
> > > Adrian
> > > _______________________________________
> > > Adrian Dick (adrian.dick@uk.ibm.com)
> > >
> > > Roshan Weerasuriya <roshan@opensource.lk> wrote on 18/01/2005
> > 10:09:10:
> > >
> > > > hi All,
> > > >
> > > > I would like to sujjest the following.
> > > >
> > > > Currently IHeaderBlock has the following 2 API functions to create
> > > > Attributesl
> > > >
> > > >  - IAttribute* createAttribute(const AxisChar* localname,
> > > >         const AxisChar* prefix,
> > > >         const AxisChar* uri, const AxisChar* value) = 0;
> > > >
> > > >   - IAttribute* createAttribute(const AxisChar *localname,
> > > >         const AxisChar *prefix, const AxisChar *value) = 0;
> > > >
> > > > Having this conversation I would like to propose the two following
> > > > methods instead of the above 2. (Actualy the first one is the
> > same)
> > > >
> > > > - IAttribute* createAttribute(const AxisChar* localname,
> > > >         const AxisChar* prefix,
> > > >         const AxisChar* uri, const AxisChar* value) = 0;
> > > >
> > > >   - IAttribute* createAttribute(const AxisChar *localname,
> > > >         const AxisChar *namespaceURI, const AxisChar *value) = 0;
> > > >
> > > > I would like to get comments from all of you rgding this issue.
> > > >
> > > > Roshan
> > > >
> > > >
> > > >
> > > > On Tue, 2005-01-18 at 09:26, Roshan Weerasuriya wrote:
> > > > > hi All,
> > > > >
> > > > > Any issues of adapting this API as James suggest?
> > > > >
> > > > > Roshan
> > > > >
> > > > > On Mon, 2005-01-17 at 17:58, James Jose wrote:
> > > > > > Roshan,
> > > > > >     There are two APIs for creating attributes in
> > IHeaderBlock.
> > > > > >
> > > > > >     1. createAttribute(const AxisChar *localname, const
> > AxisChar
> > > > > > *prefix, const AxisChar *value)=0
> > > > > >
> > > > > >      2.createAttribute(const AxisChar *localname, const
> > AxisChar
> > > > > > *prefix, const AxisChar *uri, const AxisChar *value)=0
> > > > > >
> > > > > >    In the second Type if we pass prefix then its functionality
> > is
> > > same
> > > > > > as first type.
> > > > > >    So is this possible to change the second type to
> > > > > >       createAttribute(const AxisChar *localname,const AxisChar
> > *uri,
> > > > > > const AxisChar *value)=0
> > > > > >
> > > > > >    Is this help a little?
> > > > > >
> > > > > >
> > > > > > Regards
> > > > > > James
> > > > > > --------------------------------------------------
> > > > > > James Jose
> > > > > > Messaging Clients Team, WMQDDC
> > > > > > IBM Software Labs, India
> > > > > > Direct: 91-80- 25094331  Ext :2331
> > > > > > E-mail: jamejose@in.ibm.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Roshan Weerasuriya
> > > > > > <roshan@opensource.lk>
> > > > > >
> > > > > > 17/01/2005 16:43
> > > > > >          Please respond to
> > > > > >   "Apache AXIS C Developers List"
> > > > > >                To
> > > > > > Apache AXIS C
> > > > > > Developers List
> > > > > > <axis-c-dev@ws.apache.org>
> > > > > >                cc
> > > > > >
> > > > > >           Subject
> > > > > > Re: Regarding
> > > > > > createAttribute()
> > > > > > in IHeaderBlock
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > hi James,
> > > > > >
> > > > > > >     URI of an attribute means uri associated with its
> > namespace
> > > > > > >prefix. Is this right?
> > > > > > Yes
> > > > > >
> > > > > > Actualy what matters is not the prefix, the namespace. So what
> > we
> > > > > > thought initialy was not to let the user spacify the prefix,
> > but only
> > > > > > to
> > > > > > specify the namespaceURI, and that the engine will decide the
> > > > > > corrosponding prefix properly and correctly and will also look
> > after
> > > > > > declaring namespace if needed.
> > > > > > But later there was a requirement by the users to also specify
> > the
> > > > > > prefix when ever they want. We allowed this even though it was
> > not
> > > the
> > > > > > correct way of doing things. Because when users also specify
> > there
> > > > > > prefixes then there can be prefix clashes. Any how we allowed
> > this.
> > > > > >
> > > > > > So the situation (or the logic) inside the Attribute class is
> > this:
> > > > > > - If a user specify his/her prefix, it is the duty of the user
> > to
> > > > > > create the namespace declaratoin as well.So that the Attribute
> > class
> > > > > > will not even bother to see the current namespaceURI. So in
> > your case
> > > > > > what happens is that Attibute class will not bother about the
> > > > > > namespaceURI provided.
> > > > > > - If the user doesn't specify the prefix, but only the
> > namespaceURI,
> > > > > > the Attribute class correctly serialize by adding the correct
> > prefix
> > > > > > and
> > > > > > if necessory will even add the namespace declaration to the
> > > serialized
> > > > > > out put.
> > > > > >
> > > > > > >     phb->createNamespaceDecl("np","http://axis.com");
> > > > > > >
> > > > > > >
> > *attr=phb->createAttribute("Name","np","http://apache.com","AXIS");
> > > > > > >       In this prefix of Name become 'np'. But uri of Name
> > will be
> > > > > > > "http://apache.com".
> > > > > > So according to the above explanation you will realize that
> > even
> > > > > > thought
> > > > > > the uri of the Attribute is specified as "http://apache.com",
> > in the
> > > > > > serialized out put it is actualy not "http://apache.com", but
> > it is
> > > > > > "http://axis.com".
> > > > > >
> > > > > > I even see some problems here. Can you come up with your
> > > > > > idea/suggestion
> > > > > > for this. Any thing which you think we have to do in our
> > code...
> > > > > >
> > > > > > Roshan
> > > > > >
> > > > > >
> > > > > > On Mon, 2005-01-17 at 16:42, James Jose wrote:
> > > > > > > Roshan,
> > > > > > >
> > > > > > >       URI of an attribute really confusing me -
> > > > > > >
> > ---------------------------------------------------------
> > > > > > >      phb->createNamespaceDecl("np","http://axis.com");
> > > > > > >
> > > > > > >
> > *attr=phb->createAttribute("Name","np","http://apache.com","AXIS");
> > > > > > >       In this prefix of Name become 'np'. But uri of Name
> > will be
> > > > > > > "http://apache.com".
> > > > > > >      URI of an attribute means uri associated with its
> > namespace
> > > > > > > prefix. Is this right?
> > > > > > >
> > > > > > >
> > > > > > > Thanks & Regards
> > > > > > > James
> > > > > > > --------------------------------------------------
> > > > > > > James Jose
> > > > > > > Messaging Clients Team, WMQDDC
> > > > > > > IBM Software Labs, India
> > > > > > > Direct: 91-80- 25094331  Ext :2331
> > > > > > > E-mail: jamejose@in.ibm.com
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Roshan Weerasuriya
> > > > > > > <roshan@opensource.lk>
> > > > > > >
> > > > > > > 17/01/2005 14:46
> > > > > > >          Please respond to
> > > > > > >   "Apache AXIS C Developers List"
> > > > > > >                To
> > > > > > > Apache AXIS C
> > > > > > > Developers List
> > > > > > > <axis-c-dev@ws.apache.org>
> > > > > > >                cc
> > > > > > >
> > > > > > >           Subject
> > > > > > > Re: Regarding
> > > > > > > createAttribute()
> > > > > > > in IHeaderBlock
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > hi James,
> > > > > > >
> > > > > > > >   But In this API call if I give all the four parameters
> > then it
> > > > > > > does
> > > > > > > not create a namespace declaration.
> > > > > > > >            IHeaderBlock
> > > > > > > >
> > > > > > >
> > > > > >
> > *phb=ws.createSOAPHeaderBlock("TestHeader","http://axis.apache.com");
> > > > > > > >         IAttribute
> > > > > > > >
> > > > > >
> > *attr=phb->createAttribute("Name","np","http://apache.com","AXIS");
> > > > > > > >    The resultant SOAP Header is
> > > > > > > >         <SOAP-ENV:Header>
> > > > > > > >              <ns2:TestHeader
> > xmlns:ns2="http://axis.apache.com"
> > > > > > > > np:Name="AXIS">
> > > > > > > >              </ns2:TestHeader>
> > > > > > > >         </SOAP-ENV:Header>
> > > > > > > >
> > > > > > > >    Is this a bug?
> > > > > > > Actualy if the user is specifing his/her own prefix, the
> > current
> > > way
> > > > > > > of
> > > > > > > doing things is that the user also has to add the namespace
> > > > > > > declaration
> > > > > > > to match his/her prefix (using the createNamespaceDecl()
> > method).
> > > > > > > Since
> > > > > > > the namespace declaration is not given, you get this out
> > put. Is
> > > > > > this
> > > > > > > approach OK?
> > > > > > >
> > > > > > > >   if I pass prefix as empty string and all other
> > parameters like
> > > > > > the
> > > > > > > >following.
> > > > > > > >              HeaderBlock
> > > > > > > >
> > > > > > >
> > > > > >
> > *phb=ws.createSOAPHeaderBlock("TestHeader","http://axis.apache.com");
> > > > > > > >              IAttribute
> > > > > > > >
> > *attr=phb->createAttribute("Name","","http://apache.com","AXIS");
> > > > > > > >    This will create a namespace declaration.
> > > > > > > >   <SOAP-ENV:Header>
> > > > > > > >       <ns2:TestHeader xmlns:ns2="http://axis.apache.com"
> > > > > > > > xmlns:ns3="http://apache.com" ns3:Name="AXIS">
> > > > > > > >       </ns2:TestHeader>
> > > > > > > >    </SOAP-ENV:Header>
> > > > > > >
> > > > > > > Here the namespace "http://apache.com" is declared twice.
Is
> > this
> > > OK
> > > > > > > or
> > > > > > > should we check this and declare only one?
> > > > > > >
> > > > > > > Roshan
> > > > > > >
> > > > > > > On Fri, 2005-01-14 at 19:15, James Jose wrote:
> > > > > > > > Hi Roshan,
> > > > > > > >
> > > > > > > >    A small doubt in createAttribute (const AxisChar
> > *localname,
> > > > > > > const
> > > > > > > > AxisChar *prefix, const AxisChar *uri, const AxisChar
> > *value) API
> > > > > > in
> > > > > > > > IHeaderBlock
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> > >
> >
>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

> > >
> > > > > > > >
> > > > > > > >
> > > > > > > >    if I pass prefix as empty string and all other
> > parameters like
> > > > > > > the
> > > > > > > > following.
> > > > > > > >              HeaderBlock
> > > > > > > >
> > > > > > >
> > > > > >
> > *phb=ws.createSOAPHeaderBlock("TestHeader","http://axis.apache.com");
> > > > > > > >              IAttribute
> > > > > > > >
> > *attr=phb->createAttribute("Name","","http://apache.com","AXIS");
> > > > > > > >    This will create a namespace declaration.
> > > > > > > >   <SOAP-ENV:Header>
> > > > > > > >       <ns2:TestHeader xmlns:ns2="http://axis.apache.com"
> > > > > > > > xmlns:ns3="http://apache.com" ns3:Name="AXIS">
> > > > > > > >       </ns2:TestHeader>
> > > > > > > >    </SOAP-ENV:Header>
> > > > > > > >
> > > > > > > >    But In this API call if I give all the four parameters
> > then it
> > > > > > > does
> > > > > > > > not create a namespace declaration.
> > > > > > > >            IHeaderBlock
> > > > > > > >
> > > > > > >
> > > > > >
> > *phb=ws.createSOAPHeaderBlock("TestHeader","http://axis.apache.com");
> > > > > > > >         IAttribute
> > > > > > > >
> > > > > >
> > *attr=phb->createAttribute("Name","np","http://apache.com","AXIS");
> > > > > > > >    The resultant SOAP Header is
> > > > > > > >         <SOAP-ENV:Header>
> > > > > > > >              <ns2:TestHeader
> > xmlns:ns2="http://axis.apache.com"
> > > > > > > > np:Name="AXIS">
> > > > > > > >              </ns2:TestHeader>
> > > > > > > >         </SOAP-ENV:Header>
> > > > > > > >
> > > > > > > >    Is this a bug?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Regards
> > > > > > > > James
> > > > > > > > --------------------------------------------------
> > > > > > > > James Jose
> > > > > > > > Messaging Clients Team, WMQDDC
> > > > > > > > IBM Software Labs, India
> > > > > > > > Direct: 91-80- 25094331  Ext :2331
> > > > > > > > E-mail: jamejose@in.ibm.com
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
>


Mime
View raw message