gsoap示例

来源:互联网 发布:win7 如何制作mac系统 编辑:程序博客网 时间:2024/06/08 05:59

Plus.wsdl

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/Plus/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Plus" targetNamespace="http://www.example.org/Plus/">  <wsdl:types>    <xsd:schema targetNamespace="http://www.example.org/Plus/">      <xsd:element name="PlusRequest">        <xsd:complexType>          <xsd:sequence>          <xsd:element name="x" type="xsd:float" />          <xsd:element name="y" type="xsd:float"></xsd:element>          </xsd:sequence>        </xsd:complexType>      </xsd:element>      <xsd:element name="PlusResponse">        <xsd:complexType>          <xsd:sequence>            <xsd:element name="out" type="xsd:float"/>          </xsd:sequence>        </xsd:complexType>      </xsd:element>    </xsd:schema>  </wsdl:types>  <wsdl:message name="PlusRequest">    <wsdl:part element="tns:PlusRequest" name="parameters"/>  </wsdl:message>  <wsdl:message name="PlusResponse">    <wsdl:part element="tns:PlusResponse" name="parameters"/>  </wsdl:message>  <wsdl:portType name="Plus">    <wsdl:operation name="Plus">      <wsdl:input message="tns:PlusRequest"/>      <wsdl:output message="tns:PlusResponse"/>    </wsdl:operation>  </wsdl:portType>  <wsdl:binding name="PlusSOAP" type="tns:Plus">    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>    <wsdl:operation name="Plus">      <soap:operation soapAction="http://www.example.org/plus/Plus"/>      <wsdl:input>        <soap:body use="literal"/>      </wsdl:input>      <wsdl:output>        <soap:body use="literal"/>      </wsdl:output>    </wsdl:operation>  </wsdl:binding>  <wsdl:service name="Plus">    <wsdl:port binding="tns:PlusSOAP" name="PlusSOAP">      <soap:address location="http://www.example.org/"/>    </wsdl:port>  </wsdl:service></wsdl:definitions>


wsdl2h.sh

#!/bin/sh#wsdl协议文件转换为头文件.h脚本#typemap.dat指定明明空间对应的类前缀 不可重复#多个wsdl协议文件的命名空间也不可以重复rm ./wsdl_h/*INC_PATH=/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/WS#/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/wsdl/wsdl2h -I${INC_PATH} -o ./wsdl_h/Plus.h ./wsdl_src/Plus.wsdl/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/wsdl/wsdl2h -I${INC_PATH} -o ./wsdl_h/CBSInterface_BusinessMgr.h ./wsdl_src/CBSInterface_BusinessMgr.xsd -t typemap.dat

soapcpp2_S.sh

#!/bin/sh#生成gsoap服务端代码脚本#rm ./server/c/*#rm ./server/cpp_inherited/*#rm ./server/cpp_basic/*rm ./server/Plus/*#-x don't generate sample XML message files#-S generate server-side code only#-L don't generate soapClientLib/soapServerLib/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/src/soapcpp2 -x -S -L ./wsdl_h/Plus.h -d./server/Plus#-i generate C++ service proxies and objects inherited from soap struct#soapcpp2 -S -i ./wsdl_h/Plus.h -d./server/cpp_inherited#-j generate C++ service proxies and objects that share a soap struct#soapcpp2 -S -j ./wsdl_h/Plus.h -d./server/cpp_basic

soapcpp2_C.sh

#!/bin/sh#生成gsoap客户端代码脚本#rm ./client/c/*#rm ./client/cpp_inherited/*#rm ./client/cpp_basic/*#rm ./client/Plus/*rm ./client/CallCrmWebservice/*#-x don't generate sample XML message files#-C generate client-side code only#-L don't generate soapClientLib/soapServerLib#/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/src/soapcpp2 -x -C -L ./wsdl_h/Plus.h -d./client/Plus/opt/opthb/user/jiangx/code/gsoap/gsoap-2.7/gsoap/src/soapcpp2 -x -C -L ./wsdl_h/CallCrmWebservice.h -d./client/CallCrmWebservice#-i generate C++ service proxies and objects inherited from soap struct#soapcpp2 -C -i ./wsdl_h/Plus.h -d./client/cpp_inherited#-j generate C++ service proxies and objects that share a soap struct#soapcpp2 -C -j ./wsdl_h/Plus.h -d./client/cpp_basic

typemap.dat

ns1 = "http://www.example.org/Plus/"

0 0
原创粉丝点击