You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Thomas Baier <th...@gmx.net> on 2009/12/28 23:01:21 UTC

Getting the data type for anyType

Hi,

after changing the WSDL as Dimuthu has suggested to

      <s:element name="SetSymbol">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="pName"
type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="pData"
type="s:anyType" />
          </s:sequence>
        </s:complexType>
      </s:element>

there's still a problem open when invoking SetSymbol with a scalar type
(e.g. xsd:double).

The SOAP message is

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <SetSymbol xmlns="http://www.statconn.com/StatConnector">
         <pName>myvar</pName>
         <pData xsi:type="xsd:double">3.1415</pData>
      </SetSymbol>
   </soap:Body>
</soap:Envelope>

and adb_SetSymbol_get_pData() returns an (axiom_node_t*) only containing
"3.1415". Is there any way I can get access to the type information (the
attribte in the enclosing pData element)?

Best,
Thomas



RE : Will AXIS2C sources work only on Apache-AXIS

Posted by Olivier Mengué <om...@oxymel.com>.

Websphere, Weblogic, and Tomcat are all Java application servers.
So Java is is the language of choice for those targets.


-------- Message d'origine--------
De: ramesh Gopal [mailto:fatuzorin2001@yahoo.com]
Date: mer. 20/01/2010 08 h 01
À: Apache AXIS C User List
Objet : Re: Will AXIS2C sources work only on Apache-AXIS
 

thnx.

So, if I want to have my source which will work on most application servers, whats the way to go (I don't want to use AXIS2JAVA)

Ramesh.


Re: Will AXIS2C sources work only on Apache-AXIS

Posted by ramesh Gopal <fa...@yahoo.com>.
thnx.

So, if I want to have my source which will work on most application servers, whats the way to go (I don't want to use AXIS2JAVA)

Ramesh.


--- On Fri, 15/1/10, Selvaratnam Uthaiyashankar <ut...@gmail.com> wrote:

> From: Selvaratnam Uthaiyashankar <ut...@gmail.com>
> Subject: Re: Will AXIS2C sources work only on Apache-AXIS
> To: "Apache AXIS C User List" <ax...@ws.apache.org>
> Date: Friday, 15 January, 2010, 5:37 PM
> Hi,
> 
> No, you can't. You can only run it as stand alone (simple
> axis server)
> or on httpd or IIS.
> 
> Regards,
> Shankar
> 
> On Fri, Jan 15, 2010 at 4:44 PM, ramesh Gopal <fa...@yahoo.com>
> wrote:
> >
> > Hello,
> >
> > I am having a source code written using AXIS2C apis.
> > Can these source be used as-is on Websphere or
> weblogic or tomcat or
> > any other application server ?
> >
> > NOTE : My source is entirely on C...
> >
> > Rgds,
> > RG.
> >
> >
> >      The INTERNET now has a personality. YOURS! See
> your Yahoo! Homepage. http://in.yahoo.com/
> >
> 
> 
> 
> -- 
> S.Uthaiyashankar
> Software Architect
> WSO2 Inc.
> http://wso2.com/ - "The Open Source SOA Company"
> 


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Re: Will AXIS2C sources work only on Apache-AXIS

Posted by Selvaratnam Uthaiyashankar <ut...@gmail.com>.
Hi,

No, you can't. You can only run it as stand alone (simple axis server)
or on httpd or IIS.

Regards,
Shankar

On Fri, Jan 15, 2010 at 4:44 PM, ramesh Gopal <fa...@yahoo.com> wrote:
>
> Hello,
>
> I am having a source code written using AXIS2C apis.
> Can these source be used as-is on Websphere or weblogic or tomcat or
> any other application server ?
>
> NOTE : My source is entirely on C...
>
> Rgds,
> RG.
>
>
>      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
>



-- 
S.Uthaiyashankar
Software Architect
WSO2 Inc.
http://wso2.com/ - "The Open Source SOA Company"

Will AXIS2C sources work only on Apache-AXIS

Posted by ramesh Gopal <fa...@yahoo.com>.
Hello,

I am having a source code written using AXIS2C apis.
Can these source be used as-is on Websphere or weblogic or tomcat or
any other application server ?

NOTE : My source is entirely on C...

Rgds,
RG.


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Re: Getting the data type for anyType

Posted by Thomas Baier <th...@gmx.net>.
Hi Dimuthu,

Dimuthu Gamage schrieb:
> Can you check the deserialization code for the pData in adb_SetSymbol?
> It should be
>                                         {
>                                           axiom_node_t
> *current_property_node = current_node;
>                                           current_node =
> axiom_node_get_next_sibling(current_node, env);
>                                          
> axiom_node_detach(current_property_node, env);
>                                           status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>                                                                          
> current_property_node);
>                                         }

No, it is not. It already shows the code you posted below.


> If it is the following one, you should be trying without the the anyType.
> 
>                                          
> if(axiom_node_get_first_child(current_node, env))
>                                           {
>                                               axiom_node_t
> *current_property_node = axiom_node_get_first_child(current_node, env);
>                                              
> axiom_node_detach(current_property_node, env);
>                                               status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>                                                                          
> current_property_node);
>                                           }
>                                           else
>                                           {
>                                               status = <xsl:value-of
> select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
> select="$name"/>, env,
>                                                                          
> NULL);

The full deserialize code is shown below. BTW., I am using WSDL2C from
axis2c 1.6.0

        axis2_status_t AXIS2_CALL
        adb_SetSymbol_deserialize(
                adb_SetSymbol_t* _SetSymbol,
                const axutil_env_t *env,
                axiom_node_t **dp_parent,
                axis2_bool_t *dp_is_early_node_valid,
                axis2_bool_t dont_care_minoccurs)
        {
          axiom_node_t *parent = *dp_parent;

          axis2_status_t status = AXIS2_SUCCESS;

             const axis2_char_t* text_value = NULL;
             axutil_qname_t *qname = NULL;

            axutil_qname_t *element_qname = NULL;

               axiom_node_t *first_node = NULL;
               axis2_bool_t is_early_node_valid = AXIS2_TRUE;
               axiom_node_t *current_node = NULL;
               axiom_element_t *current_element = NULL;

            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _SetSymbol, AXIS2_FAILURE);



              while(parent && axiom_node_get_node_type(parent, env) !=
AXIOM_ELEMENT)
              {
                  parent = axiom_node_get_next_sibling(parent, env);
              }
              if (NULL == parent)
              {
                /* This should be checked before everything */
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                            "Failed in building adb object for SetSymbol : "
                            "NULL elemenet can not be passed to
deserialize");
                return AXIS2_FAILURE;
              }


                    current_element = (axiom_element_t
*)axiom_node_get_data_element(parent, env);
                    qname = axiom_element_get_qname(current_element,
env, parent);
                    if (axutil_qname_equals(qname, env, _SetSymbol-> qname))
                    {

                          first_node =
axiom_node_get_first_child(parent, env);

                    }
                    else
                    {
                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                              "Failed in building adb object for
SetSymbol : "
                              "Expected %s but returned %s",
                              axutil_qname_to_string(_SetSymbol-> qname,
env),
                              axutil_qname_to_string(qname, env));

                        return AXIS2_FAILURE;
                    }



                     /*
                      * building pName element
                      */



                                   current_node = first_node;
                                   is_early_node_valid = AXIS2_FALSE;


                                    while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                    {
                                        current_node =
axiom_node_get_next_sibling(current_node, env);
                                    }
                                    if(current_node != NULL)
                                    {
                                        current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                        qname =
axiom_element_get_qname(current_element, env, current_node);
                                    }

                                 element_qname =
axutil_qname_create(env, "pName",
"http://www.statconn.com/StatConnector", NULL);


                           if (
                                (current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname))))
                           {
                              if( current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname)))
                              {
                                is_early_node_valid = AXIS2_TRUE;
                              }


                                      text_value =
axiom_element_get_text(current_element, env, current_node);
                                      if(text_value != NULL)
                                      {
                                            status =
adb_SetSymbol_set_pName(_SetSymbol, env,
                                                               text_value);
                                      }

                                      else
                                      {
                                            /*
                                             * axis2_qname_t *qname = NULL;
                                             * axiom_attribute_t
*the_attri = NULL;
                                             *
                                             * qname =
axutil_qname_create(env, "nil",
"http://www.w3.org/2001/XMLSchema-instance", "xsi");
                                             * the_attri =
axiom_element_get_attribute(current_element, env, qname);
                                             */
                                            /* currently thereis a bug
in the axiom_element_get_attribute, so we have to go to this bad method */

                                            axiom_attribute_t *the_attri
= NULL;
                                            axis2_char_t *attrib_text =
NULL;
                                            axutil_hash_t
*attribute_hash = NULL;

                                            attribute_hash =
axiom_element_get_all_attributes(current_element, env);

                                            attrib_text = NULL;
                                            if(attribute_hash)
                                            {
                                                 axutil_hash_index_t *hi;
                                                 void *val;
                                                 const void *key;

                                                 for (hi =
axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi))
                                                 {

axutil_hash_this(hi, &key, NULL, &val);


if(strstr((axis2_char_t*)key,
"nil|http://www.w3.org/2001/XMLSchema-instance"))
                                                     {
                                                         the_attri =
(axiom_attribute_t*)val;
                                                         break;
                                                     }
                                                 }
                                            }

                                            if(the_attri)
                                            {
                                                attrib_text =
axiom_attribute_get_value(the_attri, env);
                                            }
                                            else
                                            {
                                                /* this is hoping that
attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this
happnes when name is in default namespace */
                                                attrib_text =
axiom_element_get_attribute_value_by_name(current_element, env, "nil");
                                            }

                                            if(attrib_text && 0 ==
axutil_strcmp(attrib_text, "1"))
                                            {

AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non
nillable element pName");
                                                status = AXIS2_FAILURE;
                                            }
                                            else
                                            {
                                                /* after all, we found
this is a empty string */
                                                status =
adb_SetSymbol_set_pName(_SetSymbol, env,
                                                                   "");
                                            }
                                      }

                                 if(AXIS2_FAILURE ==  status)
                                 {
                                     AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in setting the value for pName ");
                                     if(element_qname)
                                     {

axutil_qname_free(element_qname, env);
                                     }
                                     return AXIS2_FAILURE;
                                 }
                              }

                  if(element_qname)
                  {
                     axutil_qname_free(element_qname, env);
                     element_qname = NULL;
                  }



                     /*
                      * building pData element
                      */



                                    /*
                                     * because elements are ordered this
works fine
                                     */


                                   if(current_node != NULL &&
is_early_node_valid)
                                   {
                                       current_node =
axiom_node_get_next_sibling(current_node, env);


                                        while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                        {
                                            current_node =
axiom_node_get_next_sibling(current_node, env);
                                        }
                                        if(current_node != NULL)
                                        {
                                            current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                            qname =
axiom_element_get_qname(current_element, env, current_node);
                                        }

                                   }
                                   is_early_node_valid = AXIS2_FALSE;

                                 element_qname =
axutil_qname_create(env, "pData",
"http://www.statconn.com/StatConnector", NULL);


                           if (
                                (current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname))))
                           {
                              if( current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname)))
                              {
                                is_early_node_valid = AXIS2_TRUE;
                              }


                                      text_value = NULL; /* just to
avoid warning */


if(axiom_node_get_first_child(current_node, env))
                                          {
                                              axiom_node_t
*current_property_node = axiom_node_get_first_child(current_node, env);

axiom_node_detach(current_property_node, env);
                                              status =
adb_SetSymbol_set_pData(_SetSymbol, env,

  current_property_node);
                                          }
                                          else
                                          {
                                              status =
adb_SetSymbol_set_pData(_SetSymbol, env,

  NULL);
                                          }

                                 if(AXIS2_FAILURE ==  status)
                                 {
                                     AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in setting the value for pData ");
                                     if(element_qname)
                                     {

axutil_qname_free(element_qname, env);
                                     }
                                     return AXIS2_FAILURE;
                                 }
                              }

                  if(element_qname)
                  {
                     axutil_qname_free(element_qname, env);
                     element_qname = NULL;
                  }

          return status;
       }

Best,
Thomas


Re: Getting the data type for anyType

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi,

Can you check the deserialization code for the pData in adb_SetSymbol?
It should be
                                        {
                                          axiom_node_t
*current_property_node = current_node;
                                          current_node =
axiom_node_get_next_sibling(current_node, env);

axiom_node_detach(current_property_node, env);
                                          status = <xsl:value-of
select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
select="$name"/>, env,

current_property_node);
                                        }

If it is the following one, you should be trying without the the anyType.


if(axiom_node_get_first_child(current_node, env))
                                          {
                                              axiom_node_t
*current_property_node = axiom_node_get_first_child(current_node, env);

axiom_node_detach(current_property_node, env);
                                              status = <xsl:value-of
select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
select="$name"/>, env,

current_property_node);
                                          }
                                          else
                                          {
                                              status = <xsl:value-of
select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of
select="$name"/>, env,

NULL);
                                          }


Thanks
Dimuthu


On Tue, Dec 29, 2009 at 3:31 AM, Thomas Baier <th...@gmx.net> wrote:

> Hi,
>
> after changing the WSDL as Dimuthu has suggested to
>
>      <s:element name="SetSymbol">
>        <s:complexType>
>          <s:sequence>
>            <s:element minOccurs="0" maxOccurs="1" name="pName"
> type="s:string" />
>            <s:element minOccurs="0" maxOccurs="1" name="pData"
> type="s:anyType" />
>          </s:sequence>
>        </s:complexType>
>      </s:element>
>
> there's still a problem open when invoking SetSymbol with a scalar type
> (e.g. xsd:double).
>
> The SOAP message is
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <soap:Body>
>      <SetSymbol xmlns="http://www.statconn.com/StatConnector">
>         <pName>myvar</pName>
>         <pData xsi:type="xsd:double">3.1415</pData>
>      </SetSymbol>
>   </soap:Body>
> </soap:Envelope>
>
> and adb_SetSymbol_get_pData() returns an (axiom_node_t*) only containing
> "3.1415". Is there any way I can get access to the type information (the
> attribte in the enclosing pData element)?
>
> Best,
> Thomas
>
>
>


-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org