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 Sun, 17 Apr 2011 10:59:20 GMT
Thank you, your responses have been greatly appreciated.

Q1: I created my own map for parameter lookups
Q2: I have been looking at the axis2c source code for hints on whether or
not I should free memory. Sometimes I just use trial and error like Josef
Q3: I am using URI parameters on my rest locations. I only define parameters
in this way if they are optional. Otherwise I place the parameters in the
URI path.
Q4: I am currently using cURL to make requests to my RESTful service. I am
using SimpleXML to parse the resulting XML. So far this has proven to be
very straight forward.



On Mon, Apr 4, 2011 at 3:29 AM, Stadelmann Josef <> wrote:

>  Potential Answer to your question 1: This is a very good idea. We use a
> payload which is a collection of named collections of elements of field-name
> field-value pairs,; and we had to code the conversion from an Axiom tree
> structure our self into several named axutil hash-table where we can access
> elements by a name to get its value.  Unfortunately this hash-table is not
> sorted among the names, and the sequence off adding hash-table entries is
> not maintained for the iterator. But it is a fast hash-table alog. Happy to
> see this as official code.
> Potential Answer to your Question2: Using AXIS2_FREE at the wrong time
> results in crash; in this case not using AXIS2_FREE makes your code go. So
> far we have not seen memory leaks just removing the crashing statement.
> Better once too much first. And if something like blue-magic has implicitly
> released the memory at a lower layer, i.e. like axutil or libxml or the
> like, making your code now crash when you call AXIS2_FREE, is a working fast
> approach for us.
> Potential Answer to your Question 4: if your Client is coded in PHP and you
> assume that your web service is implemented in Axis2/C, and you understand
> that it is isolated by some protocol, then just making your client calling
> the service should work.
> How to make PHP code call a C/C++ function is unknown to me as I never used
> PHP so far. In Java it would be the JNI to use (Java Native Interface) to
> call into C/C++ or have C/C++ call Java Classes. Maybe there is a similar
> thing for PHP.
> Josef
> *Von:* dustfinger x []
> *Gesendet:* Freitag, 1. April 2011 21:42
> *An:*
> *Betreff:* Questions regarding RESTful service,parameter parsing,php
> client
> 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