zoukankan      html  css  js  c++  java
  • Axis2/c 知识点

    官网文档:  http://axis.apache.org/axis2/c/core/docs/axis2c_manual.html

    从文档中可以总结出:

    1. Axis2/C是一个用C语言实现的Web Service引擎。
    Axis2/C基于Axis2架构,支持SOAP1.1SOAP1.2协议,并且支持RESTful风格的Web Service。基于Axis2/C的Web Service可以同时暴露为SOAP和RESTful风格的服务。

    2. 构建Axis2/c服务的基本步骤:

       *Implement the functions corresponding to the operations of the service. 

        In our sample, we will have one function that implements the "greet" operation. 
        We will name that function axis2_hello_greet.

       *Implement the functions defined by the axis2_svc_skeleton interface

        axis2_svc_skeleton interface expects the functions init, invoke, on_fault and free to be implemented by our service.
        In our sample, we would implement those and name them as hello_init, hello_invoke, hello_on_fault and hello_free respectively.

       * Implement the create function, that would create an instance of the service skeleton

        The create function would create an axis2_svc_skeleton and assign the respective function pointers to map the axis2_svc_skeleton interface to   our interface implementation methods explained in the above step.

       * Implement axis2_get_instance and axis2_remove_instance functions

        These functions are used to create and destroy service instances by the engine, and each service must define these functions.

       * Write the services.xml file for the service

        The services.xml file acts as the deployment descriptor file for the service. As the bare minimum, we need to configure the service name,       operations, and the shared library file name containing the service implementation in this file.
        As previously decided, we will name the service "hello", the operation "greet" and the shared library libhello.so on Linux and hello.dll on MS     Windows.

    3. Server API  (官网文档)

    4. REST 实现(官网文档)

    编译命令:

    gcc -shared -fPIC -o libhello.so -I$AXIS2C_HOME/include/axis2-1.6.0/ -L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver hello.c

    构造XML

    例如:

      <Config>
         <value>88</value>
          <type>get</type>
      </Config>
     
            axiom_node_t *
    axis2_hello_getconfig(const axutil_env_t *env, axiom_node_t *node)
    {
            axiom_node_t* root_node_t = NULL;
            axiom_node_t* node_value = NULL;
            axiom_node_t* node_type = NULL;
            axiom_element_t * ele_root = NULL;
            axiom_element_t * ele_value = NULL;
            axiom_element_t * ele_type = NULL;

            ele_root = axiom_element_create(env, NULL, "Config", NULL, &root_node_t);

            ele_value = axiom_element_create(env, root_node_t, "value", NULL, &node_value);
            axiom_element_set_text(ele_value, env, "88", node_value);

            ele_type = axiom_element_create(env, root_node_t, "type", NULL, &node_type);
            axiom_element_set_text(ele_type, env, "get", node_type);

            return root_node_t;
    }
  • 相关阅读:
    PL/SQL编辑数据"这些查询结果不可更新,请包括ROWID或使用SELECT...FOR UPDATE获得可更新结果"处理
    软件开发是什么、如何做
    HIS系统患者实体OO设计的一点思考
    Entity Framework for Oracle 基本配置
    PowerDesigner 15学习笔记:十大模型及五大分类
    手动触发dom节点事件代码
    JavaScript 继承代码中,B.prototype = new A(); 的含义是什么?[转自知乎]
    各类知识点文章收集
    偶尔遇到的“The request was aborted:Could not create SSL/TLS secure channel.”怎么解决?
    sqlserver 树结构递归(向上递归和向下递归)
  • 原文地址:https://www.cnblogs.com/maxpak/p/4720444.html
Copyright © 2011-2022 走看看