[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-c-dev
Subject:    Re: REST requests, adb's and namespaces
From:       "=?ISO-8859-1?Q?Lu=EDs_Bilo?=" <lp.bilo () gmail ! com>
Date:       2008-10-28 13:39:20
Message-ID: aede9f250810280639l74b3f667v654fe52535c5caec () mail ! gmail ! com
[Download RAW message or body]

In that case the patch my colleague developed follows in attachment.

With these changes rest requests won't have any issues as long as the
namespace is defined @ services.xml in the following manner for each
operation:

<operation name="get_message" uri_ns="http://mps">
	  <parameter name="wsamapping">urn:get_message</parameter>
	  <parameter name="RESTMethod">GET</parameter>
	  <parameter name="RESTLocation">message/{uuid}/</parameter>
</operation>

There is one optimization that can be done, which is allowing a
default namespace for the whole service to be defined as a parameter
also @ services.xml, and only when needed overidding for one operation
the way it is now.

On Tue, Oct 28, 2008 at 6:00 AM, Dimuthu Gamage <dimuthuc@gmail.com> wrote:
> Hi Luis,
> It is a very interesting question. Thanks for raising it.
>
> I got to know, Java solved this problem by adding the necessary namespaces
> when building the request axiom from (name, value) pairs. Since they have
> the schema model at the time of processing the request, they don't need any
> parameter to specify in the services.xml as you suggested.
>
> But since in Axis2/C we don't have the message schema at the processing
> request, we have to go for one of your suggestion. I prefer the first one
> editing services.xml because it is more analogue to what Axis2/Java is
> doing. Or we can give an option to the code generator to ignore the
> namespace validation. But since we are using Axis2/Java codegen tool, it is
> not practicle to add an option that only Axis2/C need and Axis2/Java doesn't
> need. So I think soluiton 1 is more preferrable.
>
> If you already have that patch working, you are really welcomed to add it to
> Axis2/C.
>
>
> Thanks
> Dimuthu
>
>
>
> On Mon, Oct 27, 2008 at 9:35 PM, Luís Bilo <lp.bilo@gmail.com> wrote:
>>
>> Greetings,
>>
>> I've been using axis for a while now, supporting simultaneously rest
>> and soap requests. I'm also using the adb codegeneration tool from
>> axis2/java project (c data bindings creation from wsdl document ). Now
>> there is one issue when using the auto generated adb's and REST
>> requests. As you know adb will also ensure the parameters in the
>> request have the correct namespace. Problem is only using rest
>> requests we can specify that namespace. When using rest it would be
>> possible to parse the request with axiom, and ignore the namespace.
>> But with adb's that is not an option and rest requests fail within adb
>> serializarion as they miss the required namespace. This seems like a
>> flaw to me, unless i'm missing something here in which case i'd like
>> to hear some feedback.
>>
>> Anyways in order to address this issue we've come across 2 solutions.
>> The first was to include an attribute for each operation @
>> services.xml specifying the default namespace which is then used in
>> rest requests (patched src/core/deployment/svc_builder.c). The second
>> solution was to patch the xls document that specifies adb generation,
>> so there is no namespace verification for any adb (patched
>> /org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl from
>> axis2/java). What are your thoughs on this matter? Is this something
>> you will be addressing in future versions of Axis2/c?
>>
>> Regards,
>> Luís Bilo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>>
>
>
>
> --
> Thanks,
> Dimuthu Gamage
>
> http://www.dimuthu.org
> http://www.wso2.org
>

["op_ns_uri.diff" (text/x-diff)]

diff -u axis2c1.5.clean/src/core/deployment/axis2_deployment.h \
                axis2c-src-1.5.0/src/core/deployment/axis2_deployment.h
--- axis2c1.5.clean/src/core/deployment/axis2_deployment.h	2008-07-10 \
                13:51:59.000000000 +0100
+++ axis2c-src-1.5.0/src/core/deployment/axis2_deployment.h	2008-10-28 \
13:02:33.000000000 +0000 @@ -69,6 +69,7 @@
 
 /* for operations */
 #define AXIS2_MEP "mep"
+#define AXIS2_ATTURI_NS "uri_ns"
 
 /* for messages */
 #define AXIS2_MESSAGE "message"
diff -u axis2c1.5.clean/src/core/deployment/svc_builder.c \
                axis2c-src-1.5.0/src/core/deployment/svc_builder.c
--- axis2c1.5.clean/src/core/deployment/svc_builder.c	2008-07-10 13:51:59.000000000 \
                +0100
+++ axis2c-src-1.5.0/src/core/deployment/svc_builder.c	2008-10-28 13:00:44.000000000 \
+0000 @@ -510,6 +510,7 @@
         axiom_element_t *op_element = NULL;
         axiom_node_t *op_node = NULL;
         axiom_attribute_t *op_name_att = NULL;
+        axiom_attribute_t *op_uri_ns_att = NULL;
         axiom_attribute_t *op_mep_att = NULL;
         axutil_qname_t *qmep = NULL;
         axutil_qname_t *qopname = NULL;
@@ -517,8 +518,10 @@
         axutil_qname_t *qmsgrecv = NULL;
         axutil_qname_t *qmodulest = NULL;
         axutil_qname_t *qattname = NULL;
+        axutil_qname_t *qatturi_ns = NULL;
         axis2_char_t *mep_url = NULL;
         axis2_char_t *op_name = NULL;
+        axis2_char_t *op_uri_ns = NULL;
         axis2_op_t *op_desc = NULL;
         axiom_children_qname_iterator_t *params_itr = NULL;
         axiom_children_qname_iterator_t *module_itr = NULL;
@@ -537,8 +540,11 @@
         op_element = axiom_node_get_data_element(op_node, env);
         qattname = axutil_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
         op_name_att = axiom_element_get_attribute(op_element, env, qattname);
+
+
         axutil_qname_free(qattname, env);
         qattname = NULL;
+
         if (!op_name_att)
         {
             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_OP_NAME_MISSING,
@@ -546,9 +552,20 @@
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "");
             return NULL;
         }
-
         op_name = axiom_attribute_get_value(op_name_att, env);
-        qopname = axutil_qname_create(env, op_name, NULL, NULL);
+
+	/* getting operation namespace uri */
+
+        qatturi_ns = axutil_qname_create(env, AXIS2_ATTURI_NS, NULL, NULL);
+        op_uri_ns_att = axiom_element_get_attribute(op_element, env, qatturi_ns);
+
+	if (op_uri_ns_att)
+	    op_uri_ns = axiom_attribute_get_value(op_uri_ns_att, env);
+
+        axutil_qname_free(qatturi_ns, env);
+
+
+        qopname = axutil_qname_create(env, op_name, op_uri_ns, NULL);
         op_desc = axis2_op_create(env);
         axis2_op_set_qname(op_desc, env, qopname);
         axutil_qname_free(qopname, env);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic