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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值