Seapine Labs
Personal tools

Stub code

From Seapine Labs

Jump to: navigation, search


[edit] 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.

[edit] Stub Code Generation by Language

[edit] C++

gSOAP Web Site

The gSOAP download contains a WSDL parser to create C++ header files.

wsdl2h -o ttsoapcgi.h ttsoapcgi.wsdl

[edit] Perl

There is a stub code generator for Perl named, which can be found at the Cpan Web site. 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.

[edit] 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

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.


wsdl /language:CS http://localhost/ttsoapcgi.wsdl


wsdl /language:VB http://localhost/ttsoapcgi.wsdl

[edit] 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:/usr/share/java/servlet-api-2.5.jar:/usr/share/java/commons-logging.jar:/usr/share/java/activation.jar:/usr/share/java/axis-jaxrpc.jar 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.

[edit] PHP

There are several resources available for creating SOAP apps with PHP.


Issue Management Software | Source Code Control Software | Test Case Management | Requirements Management Software