How to Create Web Service Client From Wsdl
"Wsdl" refers to the XML-based web services definition language. Client-side code use interfaces to communicate (connect, pass and consume data) with the web service. Wsdl specifies services and a service has access points or ports bound to methods. The Wsdl to client-side code generation process creates interfaces for every port in the Wsdl. In addition, it generates classes for the data types and XML elements specified in the Wsdl. An interface contains methods that correspond to the methods of the web service. Client classes allow you to avoid going through the internal details of the service to determine how to use it when you want to consume data from a web service or pass data to a web service. These classes allow you to use remote methods on the client side as if those methods are local methods.
Instructions
-
Wsdl to Perl Client Library
-
1
Visit the CPAN website (see link in References section).
-
2
Download the "wsdl2perl.pl" compressed tar file.
-
-
3
Execute the following to decompress and extract the files:
tar xvzf SOAP-WSDL-2.00.10.tar.gz
-
4
Add the location of the bin directory (which contains the wsdl2perl.pl) in the "PATH" environment variable using the following:
export PATH=$PATH:<path to the bin directory>,
where <path to the bin directory> indicates the actual path to the wsdl2perl.pl file on your system.
-
5
Execute the following:
perl wsdl2perl.pl -t Google::AdWords::v200909::Types -e Google::AdWords::v200909::TargetingIdeaService -i Google::AdWords::v200909 -b ../lib https://adwords.google.com/api/adwords/o/v200909/TargetingIdeaService?wsdl
In this command, after the "-t" option, specify the prefix (part of the package name) for the XML data types. After the "-e" option, specify the prefix for the classes that corresponds to the XML elements. After the "-i" option, specify the prefix for the interfaces. The value "(lib)" after the "-b" option is the directory to contain the generated classes. "Url" indicates the location of the Wsdl for the web service.
Wsdl to PHP Client Library
-
6
Visit the "wsdl2phpgenerator" website (see link in References section).
-
7
Download "wsdl2phpgenerator1.4.1-php5.3.tar.gz."
-
8
Execute the following to decompress and extract the files:
tar xvzf wsdl2phpgenerator1.4.1-php5.3.tar.gz
-
9
Go to the directory where you have "wsdl2php" code.
-
10
Execute the following from the shell:
./wsdl2php -i https://adwords.google.com/api/adwords/o/v200909/TargetingIdeaService?wsdl -o ../lib/
where the value after "-i" indicates the Wsdl file and the value after "-o" indicates the output directory for the generated classes.
Wsdl to Java Client Library
-
11
Visit Apache's "Axis2" website (see link in References section).
-
12
Download "Axis2."
-
13
Install Apache "Axis2." ("WSDL2Java" comes with "Axis2.")
-
14
Execute the following:
java org.apache.axis.wsdl.WSDL2Java -a https://adwords.google.com/api/adwords/o/v200909/TargetingIdeaService?wsdl
In this command, "-a" tells "WSDL2Java" to generate all classes.
-
1
Tips & Warnings
Be aware that the url for Wsdl to Perl conversion tool on CPAN may change at any time as people create and add new versions of the tool on CPAN.
References
- Photo Credit Comstock Images/Comstock/Getty Images