axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dustfinger x <>
Subject Re: Questions regarding RESTful service,parameter parsing,php client
Date Sat, 02 Apr 2011 17:33:56 GMT
Dear Nandika,

Thank you very much for answering my questions. Regarding your answer to
question 2, I assume that I would never need to call AXIS2_FREE on node or
element pointers that are returned from methods that traverse the tree
structure like axiom_node_get_next_sibling for instance.

1. Am I safe to assume that the framework manages the memory for the tree
structure and that user code must only clean up data from the tree structure
that is returned as pointers such as axis2_char_t*?
2. If I am out to lunch here then what is the best way for me to know when I
have to clean up the memory? should I just be looking at the source code to
determine this? Again I apologize, I am fairly new to C/C++.
3. Does this news group prefer top or bottom posting? I see that we have
started to top post on this thread. I know some people are very passionate
about this subject and it does make sense to bottom post, but unfortunately
most email clients prefer top posting, probably thanks to MS Outlook setting
a bad standard.



On Fri, Apr 1, 2011 at 11:23 PM, Nandika Jayawardana <>wrote:

> Hi dustfinger,
> Question 1
> Currently, framework does not provide a hash data structure for accessing
> values. It was because, we wanted the service to be same for both soap and
> rest. It would be a good approach write a wrapper class and implement hasKey
> getValue methods.
> Question 2
> It is correct to call AXIS2_FREE after axiom_node_to_string since to_string
> will return an allocated string.
> Regards
> Nandika
> On Sat, Apr 2, 2011 at 1:11 AM, dustfinger x <>wrote:
>> Hi,
>> I am brand new to the list. I sent a request to   <
>>> before making this post, but there are no
>> FAQ's available yet. I am a newbie, so I apologize in advance to anyone that
>> I annoy with my amateur questions. I will present the environment that I am
>> working in, what I am trying to accomplish and finally a list of questions
>> that I hope to get answered.
>> Environment:
>> OS: 2.6.34-gentoo-r1 #2 SMP Mon Sep 13 00:17:55 MDT 2010 x86_64 Intel(R)
>> Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
>> Servers: axis2_http_server 1.6.0, www-servers/apache-2.2.16
>> C/C++ Compiler: sys-devel/gcc-4.4.3-r2
>> Web template language: dev-lang/php-5.3.5
>> Brief Goal Description:
>> To Write a RESTful service with the responsability of acting as the Data
>> Access Layer for an application. The service must be able to be called from
>> both PHP and another C++ application.
>> Questions:
>> 1. What is the cleanest way to access the values of the parameters that I
>> am passing to my restful service. Currently I have been calling
>> axiom_node_get_first_child followed by subsequent calls to
>> axiom_node_get_next_sibling to travers my parameter list. I was wondering if
>> the framework has a hash data structure that I could pass in the name of the
>> parameter and it would return me the value? If such a structure is not
>> provided by the framework, would writing one be a good approach to make my
>> code more maintainable? My plan would be to pass the root node to a wrapper
>> class and then implement a hasKey and getValue method.
>> 2. I am not fully clear on when to use the AXIS2_FREE method to clean up
>> memory. Consider the following example that comes for a GET method:
>> if(AXIOM_ELEMENT == nodeType){
>>     axis2_char_t *nodeCharText = NULL;
>>     nodeCharText =
>> static_cast<axis2_char_t*>(axiom_element_to_string(childElement,
>> environment, type_node));
>>     AXIS2_LOG_USER(environment->log, AXIS2_LOG_SI, "type_node child text
>> of element= [%s] ", nodeCharText);
>>     if(NULL != nodeCharText){
>>       AXIS2_FREE(environment->allocator, nodeCharText);
>>       nodeCharText = NULL;
>>     }
>>   }
>> Am I correct to call AXIS2_FREE after I am done with nodeCharText? I did
>> not call any create methods, but perhaps it is still my responsibility to
>> clean up that memory? It has not cased any faults in the application so far.
>> 3. Is it bad practice to use URI query parameters in a RESTLocation? for
>> example, is this bad practice:
>> <operation name="getQueryParamTest">
>>     <parameter name="RESTMethod">GET</parameter>
>>     <parameter
>> name="RESTLocation">query/param/type/{type}/name/{name}/test?color={color}&flavor={flavor}</parameter>
>>   </operation>
>> I know that may seem like an odd question, but I have not found any
>> examples of people writing axis2c services that do this. They all seem to
>> write may operations with all different RESTLocations instead.
>> 4. What is the propery way of appending query parameters?
>> <parameter
>> name="RESTLocation">query/param?color={color}&flavor={flavor}</parameter>
>> or
>> <parameter
>> name="RESTLocation">query/param/?color={color}&flavor={flavor}</parameter>
>> I think that the last way leaves an empty node right before the query
>> parameters.
>> 4. What is the best way to call a RESTful service operation from PHP code?
>> Since this was my first post I was wondering if my presentation was
>> acceptable? Should I have posted 4 separate times, one for each question? IF
>> I would have broken my email up into 4 separate emails it would have been
>> easier to write a descriptive subject heading. Were any of my questions
>> dumb-questions? I have only been using axis2c actively for about a week now
>> and I really like it so far, but I have loads to learn and I am unsure if I
>> am really using it correctly.
>> Sincerely,
>> dustfinger.

View raw message