org.apache.axis2.client.Options - Operation Client Options

This section describes 3 other Axis2 classes: org.apache.axis2.description.AxisService, org.apache.axis2.client.Options and org.apache.axis2.addressing.EndpointReference.

Once we have a ServiceClient object created, we can learn 3 other related classes.

1. org.apache.axis2.description.AxisService - A class represents a Web service itself.

2. org.apache.axis2.client.Options - A class represents a holder for operation client options. It is used by the other classes in this package to configure various aspects of how a client communicates with a service.

3. org.apache.axis2.addressing.EndpointReference - A class models the WS-A EndpointReferenceType. But it can be used without any WS-A handlers as well since the models for this in Submission and Final versions are different.

Here is a test program that shows some properties of these classes:

 * Copyright (c) 2009 by Dr. Herong Yang,
 * All rights reserved
import javax.xml.namespace.QName;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.client.Options;
import org.apache.axis2.addressing.EndpointReference;
class Axis2ServiceClientGetMethod {
   public static void main(String[] args) {
      PrintStream out = System.out;

// Setting initial values
      String wsdl = "file:///C:/herong/Hello_WSDL_11_SOAP.wsdl";
      String tns = "";
      String serviceName = "helloService";
      String portName = "helloPort";

      try {

// Creating a dynamic service client with a given WSDL
         ServiceClient client = new ServiceClient(
            new URL(wsdl), 
            new QName(tns, serviceName), 

// Printing AxisService object information
         AxisService service = client.getAxisService();
         out.println("AxisService object information:");
         out.println("   service: "+service);
         out.println("   service.getCustomSchemaNamePrefix(): "
         out.println("   service.getFileName(): "
         out.println("   service.getName(): "
         out.println("   service.getServiceDescription(): "
         out.println("   service.getSoapNsUri(): "
         out.println("   service.getTargetNamespace(): "
         out.println("   service.getTargetNamespacePrefix(): "

// Printing Options object information
         Options options = client.getOptions();
         out.println("Options object information:");
         out.println("   options: "+options);
         out.println("   options.getAction(): "
         out.println("   options.getSoapVersionURI(): "
         out.println("   options.getTransportInProtocol(): "

// Printing EndpointReference object information
         EndpointReference endpoint = options.getTo();
         out.println("EndpointReference object information:");
         out.println("   endpoint: "+endpoint);
         out.println("   endpoint.getAddress(): "
         out.println("   endpoint.getName(): "

      } catch (Exception e) {

Execution of this program is described below:

C:\herong>\local\jdk\bin\java -Djava.ext.dirs=\local\axis2\lib\
log4j:WARN No appenders could be found for logger 
   (org.apache.axis2.description. WSDL11ToAxisServiceBuilder).
log4j:WARN Please initialize the log4j system properly.

AxisService object information:
   service: helloService
   service.getCustomSchemaNamePrefix(): null
   service.getFileName(): null
   service.getName(): helloService
    Copyright (c) 2007 by Dr. Herong Yang,
    All rights reserved

   service.getSoapNsUri(): null
   service.getTargetNamespacePrefix(): tns

Options object information:
   options: org.apache.axis2.client.Options@148bd3
   options.getAction(): null
   options.getTransportInProtocol(): null

EndpointReference object information:
   endpoint.getName(): null

Notes on the test program code and output:

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

 What Is Axis2?

 Downloading and Installing Axis2/Java 1.4.1

 org.apache.axis2.client.ServiceClient Class

 Creating Service Client with WSDL Document

org.apache.axis2.client.Options - Operation Client Options

 sendReceive() Method - Invoking a Named Operation

 Turning Off the Chunked HTTP Flag

 AXIOM (AXIs Object Model) - document/literal Style - document/literal Style

 org.apache.axis2.rpc.client.RPCServiceClient Class - rpc/encoded Style - Socket Server Testing Program

 Capturing the HTTP Request from an Axis2 Client Program

 Using WSDL2Java to Generate Web Service Stub Classes

 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