• 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;
    }
  • 相关阅读:
    Mongodb $in $or 性能比较
    c# mongo 数组里对象更新
    C# mongodb $set或$addToSet批量更新很慢原因
    docker 使用
    Ubuntu 下更简单的防火墙 Uncomplicated Firewall
    Docker 介绍及安装
    linux 内核分析工具 Dtrace、SystemTap、火焰图、crash等
    golang 中处理大规模tcp socket网络连接的方法,相当于c语言的 poll 或 epoll
    golang 对struct进行Serialize的方法,即将存取二进制文件到struct的方法
    golang 中创建daemon的方法
  • 原文地址:https://www.cnblogs.com/maxpak/p/4720444.html
Copyright © 2020-2023  润新知