Creation of an Axis Web Service and a gSOAP client

转载 2007年10月09日 19:51:00

 Creation of an Axis Web Service and a gSOAP client

  • Linux platform
  • C(++) Compiler
  • gSOAP 2.7.0 [download]
  • Apache Axis 1.3 [download]
  • Java jdk 1.5
  • Tomcat 5.5.9 (This tutorial assumes, that the Tomcat server runs on Port 8080.)

  • 1) Create a WSDL file
    The WSDL file <TextService.wsdl> can be generated by hand or utilizing tools for the generation of WSDL files.

    2) Build the server-side classes
    command: java org.apache.axis.wsdl.WSDL2Java --server-side --skeletonDeploy true TextService.wsdl

    The optional setting 'skeletonDeploy true' causes the automatical generation of skeleton classes for each in the header file defined method. The skeleton routines can be readily used to implement one or more of the remote methods in a new SOAP Web Service.

    The server-side classes (skeleton and service) are saved in the directory, specified by the namespace. The example Web Services with Apache Axis explaines the creation and deployment of a service more precisely.

    3) Implementation of a Web Service
    The methods of the automatically created class must be implemented.

    1) Create a header file
    Use the WSDL parser wsdl2h to create the header file <gSoapTextClient.h>. Therefore it is necessary to call the WSDL file of the created Axis Web Service, which is located at the Tomcat Web server.

    command: wsdl2h -o gSoapTextClient.h http://localhost:8080/axis/services/TextService?wsdl

    The method processData must be changed in that effect, that the parameters are pointers.
    [ processData(std:string *request, std:string *response)]

    2) Build the necessary stub and skeleton classes
    The implementation of a SOAP client application needs a stub routine for each remote method. This classes are automatically generated by the stub and skeleton compiler soapcpp2.

    command: soapcpp2 -I/<gsoap-path> gSoapTextClient.h

    3) Implementation of the client class

            #include gSoapTextClient.nsmap
            // service address
    	const char server[] = "http://localhost:8080/axis/services/TextService";
    	main() {
    	    struct soap soap;
    	    // read input
    	    ifstream infile ... 
    	    // remote call
    	    int responseflag = soap_call___ns1__processData(&soap, server, "", requestData, &responseData);


    4) Compile the client class

    g++ -Wno-deprecated -I/<gsoap-path> -o  gSoapTextClient gSoapTextClient.cpp soapC.cpp soapClient.cpp <gsoap-path>/stdsoap2.cpp


    5) Start the gSOAP client
    To start the gSOAP client, the object file must be called.

    command: gSoapTextClient -i ExampleOutput_RDF


    使用Eclipse自带的Axis1插件生成Web Service服务端/客户端

    JDK版本:1.5.0_22 Eclipse版本:Helios Service Release 2(3.6.2)
    • a19881029
    • a19881029
    • 2014年04月28日 16:01
    • 16075

    用 gSOAP 实现 Web Service 的简单例子

    gSOAP的简单使用例子 系统环境:Centos 6.3 操作系统;gsoap-2.8 例子功能:实现一个加法运算的 Web Service,当 client 端输入 num1 和 num2 ...
    • iw1210
    • iw1210
    • 2014年04月08日 17:00
    • 829

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/client/AdminClient

    Ø         AXIS_HOMED:/axis1_4Ø         AXIS_LIB%AXIS_HOME%/libØ         AXIS_CLASSPATHD:/axis1_4/lib...
    • tuwen
    • tuwen
    • 2007年10月10日 09:01
    • 8949


    Axis开发webservice 最近的几个项目由于涉及到不同领域 不同技术平台的应用,所以在各个系统的接口部分,采用了webservice技术,来实现不同系统的业务对接.由于我们采用J2EE平台,下...
    • eaglezhang
    • eaglezhang
    • 2006年01月04日 15:14
    • 7024


    参考: 参考:
    • fxtxz2
    • fxtxz2
    • 2012年10月11日 16:44
    • 4581

    Axis部署开发webservice (三种方式全)

    Axis支持三种web service的部署和开发,分别为: 1、Dynamic Invocation Interface(DII) 2、Dynamic Proxy方式 3、Stubs方式 其...
    • lw371496536
    • lw371496536
    • 2012年10月12日 18:05
    • 534

    直接AXIS调用远程的web service

    import javax.xml.namespace.QName; import org.apache.axis.client.Call; import org.apache.axis.client...
    • yiluoAK_47
    • yiluoAK_47
    • 2015年04月08日 10:22
    • 1682

    解决IWAB0489E Error when deploying Web service to Axis runtime

    WebEclipse应用服务器WebServiceSOAP  eclipse europa自带web工具。我们可以使他生成动态web程序。但是在默认情况下,生成的动态默认程序是不包含we...
    • b222007
    • b222007
    • 2013年07月12日 11:04
    • 3780


    WebService、soap、gsoap基本概念 WebService服务基本概念:就是一个应用程序,它向外界暴露出一个可以通过web进行调用的API,是分布式的服务组件。本质上就是要以标准的形式实...
    • iamherego
    • iamherego
    • 2015年10月13日 17:36
    • 1677

    axis 生成客户端client stub文件

    开发前,有个同事先给我们不熟悉Web Service的程序员进行了一些培训,我才知道原来以前的Web Service都是可以自动生成代码的,而且也不难,试了一个下午客户端和服务器端的Web Servi...
    • qiao000_000
    • qiao000_000
    • 2010年05月07日 21:51
    • 8073
    您举报文章: Creation of an Axis Web Service and a gSOAP client