axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nandika Jayawardana <jayaw...@gmail.com>
Subject Re: Questions regarding RESTful service,parameter parsing,php client
Date Sat, 02 Apr 2011 05:23:03 GMT
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 <dustfinger@muddymukluk.com>wrote:

> Hi,
>
> I am brand new to the list. I sent a request to   <
> c-user-info@axis.apache.org> 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:
>
> //QUESTION 1
> 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.
>
> //QUESTION 2
> 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.
>
> //QUESTION 3
> 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.
>
> //QUESTION 4
> 4. What is the best way to call a RESTful service operation from PHP code?
>
> //END QUESTIONS
>
> 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.
>

Mime
View raw message