Contents About Stub Code Generation Stub Code Generation

Stub_code
Contents
• 1 About Stub Code
Generation
• 2 Stub Code Generation by
Language
♦ 2.1 C++
♦ 2.2 Perl
♦ 2.3 C# and VB.NET
♦ 2.4 Java
♦ 2.5 PHP
About Stub Code Generation
Stub code, or skeleton code, is a method of generating class files based off a web service defintion file
(WSDL). Most programming languages have SOAP tools designed to generate stub code from a WSDL file.
Stub Code Generation by Language
C++
gSOAP Web Site
The gSOAP download contains a WSDL parser to create C++ header files.
wsdl2h −o ttsoapcgi.h ttsoapcgi.wsdl
Perl
There is a stub code generator for Perl named Stubmaker.pl, which can be found at the Cpan Web site.
Submaker.pl can be found on the CPAN web site.
Perl SOAP programming requires the SOAP::Lite module.
There are many online resources for Perl SOAP programming. One of the best, because it is specific to
TestTrack, was written by David Baird of Qualcomm (also a CM Crossroads moderator). His guide can be
found on the CM Crossroads Web site.
C# and VB.NET
Visual Studio .NET installs with an application called wsdl.exe which can be used to generate stub code. This
file is usually located under the .NET SDK bin directory for example:
C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\wsdl.exe
Contents
1
Stub_code
The wsdl file supports converting a WSDL file into a .NET language stub code. There is a /language argument
that can be used to specify the .NET language to generate the stub code file in. The default language is C#.
Here are some examples commands using the TestTrack Pro WSDL file.
C#
wsdl /language:CS http://localhost/ttsoapcgi.wsdl
VB.NET
wsdl /language:VB http://localhost/ttsoapcgi.wsdl
Java
Download Java stubs
If you want to generate the stubs yourself, keep reading.
An Apache Axis routine named wsdl2java exists to create Java stub code from a WSDL source (Inversely a
WSDL file can be created from a SOAP service using java2wsdl).
You need Apache Axis to use wsdl2java. The Seapine SOAP API is C++ based and the WSDL is generated
using gSOAP. It is recommended that Axis 1.4 is used.
When running the java2wsdl program is is necessary to have the proper classpath references which include the
Axis Jar files. For example in Ubuntu 11.04 the following command should be executed:
java −cp
/usr/share/java/axis.jar:/usr/share/java/wsdl4j.jar:/usr/share/java/commons−discovery.jar:/usr/share/java/gnumail.jar:/us
org.apache.axis.wsdl.WSDL2Java http://yourserver/ttsoapcgi.wsdl Assuming that the distribution package
libaxis−java is installed.
When executed a Java source file will be generated for all the WSDL data structures and operations.
PHP
There are several resources available for creating SOAP apps with PHP.
NuSOAP
PHP−SOAP
PEAR::SOAP
C# and VB.NET
2