Stub and Data Type Classes

This section describes what are stub and data type classes. A stub class represents a service and port combination with operations as methods. A data type class represents an input or output message part.

The stub class generated from WSDL2Java has some inner classes defined. You will see them, if you compile the stub class:

C:\herong>cd axis2\src

C:\herong\axis2\src>\local\jdk\bin\javac -Djava.ext.dirs=\local\axis2\lib\

Note: com\herongyang\www\service\ uses unchecked or unsafe
Note: Recompile with -Xlint:unchecked for details.

C:\herong\axis2\src>dir com\herongyang\www\service\*.class
 Volume in drive C has no label.
 Volume Serial Number is 3708-BBAE

 Directory of C:\herong\axis2\src\com\herongyang\www\service

     834 HelloServiceStub$ExtensionMapper.class
   1,377 HelloServiceStub$HelloRequest$1.class
   1,897 HelloServiceStub$HelloRequest$Factory.class
   6,433 HelloServiceStub$HelloRequest.class
   1,382 HelloServiceStub$HelloResponse$1.class
   1,902 HelloServiceStub$HelloResponse$Factory.class
   6,442 HelloServiceStub$HelloResponse.class
   9,823 HelloServiceStub.class

If you read the Java source code, you will see those inner classes and methods defined in them. Here is a summary of these class and methods that will make Web service calling process easier:

1. HelloRequest - The data type class that represents the input message part defined in the WSDL document. HelloRequest class extends org.apache.axis2.databinding.ADBBean class.

2. HelloResponse - The data type class that represents the output message part defined in the WSDL document. HelloResponse class extends org.apache.axis2.databinding.ADBBean class.

3. HelloServiceStub - The stub class that represents a combination of service and port defined in the WSDL document. HelloServiceStub class extends org.apache.axis2.client.Stub class.

4. stub = new HelloServiceStub() - The default constructor method to create a stub object with information defined in the WSDL document.

5. out = stub.Hello(in) - The stub method that represents an operation defined in the WSDL document.

The idea of providing you the stub class and data type classes to allow you call a Web service operation using a method of a stub class instead of using the ServiceClient class. Data type classes are provided to allow you build SOAP Body element with your own data type classes instead generic OMElement classes.

See the next section for tutorial example.

Last update: 2009.

Table of Contents

 About This Book

 Introduction to WSDL 2.0

 WSDL 2.0 Document Structure and Syntax

 WSDL Version 2.0 Part 2: Adjuncts

 WSDL 2.0 Document Examples with SOAP Binding

 WSDL 20 Programming APIs and Testing Tools

 Introduction to WSDL 1.1

 WSDL 1.1 Document Structure and Syntax

 WSDL 1.1 Binding Extension for SOAP 1.1

 soapUI 3.0.1 - Web Service Testing Tool

 WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

 PHP SOAP Extension in PHP 5.3.1

 Using WSDL in Perl with SOAP::Lite 0.710

 Using WSDL Document in Java with Axis2 1.4.1

Using WSDL2Java to Generate Web Service Stub Classes

 What Is WSDL2Java?

 Generating Client Side Stub Java Code

Stub and Data Type Classes

 Using Stub and Data Type Classes

 XML Document Based Web Service Example

 "Unexpected subelement ..." Error from the Stub Class

 RPC Method Based Web Service Example

 WSDL 1.1 Binding Extension for SOAP 1.2

 WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles

 SOAP 1.2 Binding - PHP, Java and Perl Clients

 WSDL Related Terminologies


 PDF Printing Version