axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Susantha Kumara" <susan...@opensource.lk>
Subject RE: RE : Improving Hanlder writing api
Date Fri, 27 Feb 2004 05:24:18 GMT
Hi Roshan,

Its a good design. I see that there are basically 2 sets of API functions.

1. To get a header block from deserializer and traverse it for reading
2. To create and add header blocks to the serializer/deserializer.

So I suggest making the first set of functions return const pointers. Also
that
would need to make these functions const. Making them const restricts the
handler
writer from deleting the header's nodes.
Ex:
          const BasicNode* getFirstChild()const =0;
          const BasicNode* getLastChild() const =0;

Can we differ Handler writing API for C for some time ?. I mean a handler
can now
be written only in C++.

Thanks,

Susantha.

> -----Original Message-----
> From: Roshan Weerasuriya [mailto:roshan@opensource.lk]
> Sent: Wednesday, February 25, 2004 9:10 AM
> To: Apache AXIS C Developers List
> Subject: RE : Improving Hanlder writing api
>
>
> hi all,
>
> The changes include:
>
> Adding following methods to the following classes.
>
> The following let the handler writer access the Header Block and traverse
> through it to get the relavent info.
>
> - SoapDeSerializer, IHandlerSoapDeSerializer : let the handler writer get
> the HeaderBlock by providing the local name and namespace uri
> - SoapHeader : let the handler writer get the HeaderBlock by
> providing the
> local name and namespace uri
> - IHeaderBlock:
>          BasicNode* getFirstChild()=0;
>          BasicNode* getLastChild() =0;
>          BasicNode* getChild(int iChildPosition) =0;
>
> - HeaderBlock :
>          BasicNode* getFirstChild(),
>          BasicNode* getLastChild(),
>          BasicNode* getChild(int iChildPosition) // get the child
> by giving
> the positon
>          getNoOfChildren() // get the no of available children
> - BasicNode :
>          //The following let the handler writer traverse throuhg
> the children
>          int getNoOfChildren();
>          BasicNode* getFirstChild();
>          BasicNode* getLastChild();
>          BasicNode* getChild(int iChildPosition);
>
> - ComplexElement:
>          int getNoOfChildren();
>          BasicNode* getChild(int iChildPosition);
>          BasicNode* getLastChild();
>          BasicNode* getFirstChild();
>          NODE_TYPE getNodeType();
>
> - CharacterElement:
>          const AxisChar* getValue();
>
> Also some of the following methods are to be used for various other
> activities such as when creating header blocks by handlers and
> client apps.
>
> - IHeaderBlock:
>          BasicNode* createChild(NODE_TYPE eNODE_TYPE,  AxisChar
> *pachLocalName, AxisChar *pachPrefix, AxisChar *pachUri,
> AxisChar* pachValue);
>          BasicNode* createImmediateChild(NODE_TYPE eNODE_TYPE, AxisChar
> *pachLocalName, AxisChar *pachPrefix, AxisChar *pachUri,
> AxisChar* pachValue);
>          Attribute* createStdAttribute(HEADER_BLOCK_STD_ATTR_TYPE
> eStdAttrType, SOAP_VERSION eSOAP_VERSION);
>          Attribute* createAttribute(const AxisChar* localname, const
> AxisChar* prefix, const AxisChar* uri, const AxisChar* value);
>          Attribute* createAttribute(const AxisChar *localname, const
> AxisChar *prefix, const AxisChar *value);
>
> A eg code sample from a client who will add a soap header to the soap
> reqest is as following.
>
>          .....
>          //-----------Adding SOAP Header-----------
>          IHeaderBlock* pIHeaderBlock =
> m_pCall->createHeaderBlock("reservation", "m",
> "http://travelcompany.example.org/reservation");
>
>          pIHeaderBlock->createStdAttribute(ROLE_NEXT, SOAP_VER_1_2);
>          pIHeaderBlock->createStdAttribute(MUST_UNDERSTAND_TRUE,
> SOAP_VER_1_2);
>
>          BasicNode* pBasicNode =
> pIHeaderBlock->createImmediateChild(ELEMENT_NODE, "reference",
> "m", "", "");
>          BasicNode* pBasicNode2 =
> pIHeaderBlock->createChild(CHARACTER_NODE, "", "", "",
> "uuid:093a2da1-q345-739r-ba5d-pqff98fe8j7d");
>          pBasicNode->addChild(pBasicNode2);
>
>          BasicNode* pBasicNode3 =
> pIHeaderBlock->createImmediateChild(ELEMENT_NODE, "dateAndTime",
> "m", "", "");
>          BasicNode* pBasicNode4 =
> pIHeaderBlock->createChild(CHARACTER_NODE, "", "", "",
> "2001-11-29T13:20:00.000-05:00");
>          pBasicNode3->addChild(pBasicNode4);
>          //-----------End of Adding SOAP Header-----------
>          .....
>
>
> A eg code sample from a handler written to process a header is as
> following.
>
> IHeaderBlock* pIHeaderBlock=
> pIHandlerSoapDeSerializer->GetHeaderBlock("reservation",
> "http://travelcompany.example.org/reservation");
> if (pIHeaderBlock != NULL) {
>          BasicNode* pBasicNode= pIHeaderBlock->getFirstChild();
>          BasicNode* pBasicNode2= pBasicNode->getFirstChild();
>
>          const AxisChar* pachHeaderValue;
>          const AxisChar* pachHeaderValue2;
>
>          if((pBasicNode2->getNodeType()) == CHARACTER_NODE) {
>                  pachHeaderValue= pBasicNode2->getValue();
>          }
>
>          BasicNode* pBasicNode3= pIHeaderBlock->getLastChild();
>          BasicNode* pBasicNode4 =pBasicNode3->getFirstChild();
>          if((pBasicNode4->getNodeType()) == CHARACTER_NODE) {
>                  pachHeaderValue2= pBasicNode4->getValue();
>          }
>
>          .....
> }


Mime
View raw message