坚持,才是力量.老实做人,踏实做事.

msn: timothy_wangweiguo@hotmail.com

Creation of an Axis Web Service and a gSOAP client

 Creation of an Axis Web Service and a gSOAP client  

http://www.dfki.de/~sberg/smartweb/sysgroup/Axis_gSoap_Development.html





  • 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 TextServiceSoapBindingImpl.java 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;
    	    soap_init(&soap); 
    	 
    	    // read input
    	    ifstream infile ... 
    
    	    // remote call
    	    int responseflag = soap_call___ns1__processData(&soap, server, "", requestData, &responseData);
    	    	...
    	}
       

     

    4) Compile the client class
    command:

    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

     

    阅读更多
    想对作者说点什么? 我来说一句

    axis web service client 源码

    2012年10月25日 2KB 下载

    没有更多推荐了,返回首页

    加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
    关闭
    关闭