WSDL Tutorials - Herong's Tutorial Examples - v2.22, by Herong Yang
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:
/* Axis2ServiceClientGetMethod.java * Copyright (c) 2009 HerongYang.com. All Rights Reserved. */ import java.io.PrintStream; import java.net.URL; 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 server = "https://www.herongyang.com/Service/"; String wsdl = server+"Hello_WSDL_11_SOAP.wsdl"; String tns = "https://www.herongyang.com/Service/"; String serviceName = "helloService"; String portName = "helloPort"; try { // Creating a dynamic service client with a given WSDL ServiceClient client = new ServiceClient( null, new URL(wsdl), new QName(tns, serviceName), portName); // Printing AxisService object information AxisService service = client.getAxisService(); out.println(); out.println("AxisService object information:"); out.println(" service: "+service); out.println(" service.getCustomSchemaNamePrefix(): " +service.getCustomSchemaNamePrefix()); out.println(" service.getFileName(): " +service.getFileName()); out.println(" service.getName(): " +service.getName()); // getServiceDescription() is replaced by getDocumentation() // out.println(" service.getServiceDescription(): " // +service.getServiceDescription()); out.println(" service.getDocumentation(): " +service.getDocumentation()); out.println(" service.getSoapNsUri(): " +service.getSoapNsUri()); out.println(" service.getTargetNamespace(): " +service.getTargetNamespace()); out.println(" service.getTargetNamespacePrefix(): " +service.getTargetNamespacePrefix()); // Printing Options object information Options options = client.getOptions(); out.println(); out.println("Options object information:"); out.println(" options: "+options); out.println(" options.getAction(): " +options.getAction()); out.println(" options.getSoapVersionURI(): " +options.getSoapVersionURI()); out.println(" options.getTransportInProtocol(): " +options.getTransportInProtocol()); // Printing EndpointReference object information EndpointReference endpoint = options.getTo(); out.println(); out.println("EndpointReference object information:"); out.println(" endpoint: "+endpoint); out.println(" endpoint.getAddress(): " +endpoint.getAddress()); out.println(" endpoint.getName(): " +endpoint.getName()); } catch (Exception e) { e.printStackTrace(); } } }
Execution of this program is described below:
herong> java -cp .;\local\axis2\lib\* Axis2ServiceClientGetMethod AxisService object information: service: helloService service.getCustomSchemaNamePrefix(): null service.getFileName(): null service.getName(): helloService service.getServiceDescription(): Hello_WSDL_11_SOAP.wsdl Copyright (c) by Herong Yang. herongyang.com All rights reserved service.getSoapNsUri(): null service.getTargetNamespace(): https://www.herongyang.com/Service/ service.getTargetNamespacePrefix(): tns Options object information: options: org.apache.axis2.client.Options@148bd3 options.getAction(): null options.getSoapVersionURI(): http://schemas.xmlsoap.org/soap/envelope/ options.getTransportInProtocol(): null EndpointReference object information: endpoint: Address: https://www.herongyang.com/Service/Hello_SOAP_11.php endpoint.getAddress(): https://www.herongyang.com/Service/Hello_SOAP_11.php endpoint.getName(): null
Notes on the test program code and output:
Table of Contents
WSDL 2.0 Document Structure and Syntax
WSDL Version 2.0 Part 2: Adjuncts
WSDL 2.0 Document Examples with SOAP Binding
Using WSDL Document in Java Apache Axis2/Java for WSDL
Apache Woden for WSDL Documents in Java
SoapUI - Web Service Testing Tool
WSDL 1.1 Document Structure and Syntax
WSDL 1.1 Binding Extension for SOAP 1.1
SoapUI as WSDL 1.1 Testing Tool
WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles
PHP SOAP Extension for WSDL 1.1
►Apache Axis2/Java for WSDL 1.1
Creating Service Client with WSDL 1.1 Document
►org.apache.axis2.client.Options - Operation Client Options
sendReceive() Method - Invoking a Named Operation
Turning Off the Chunked HTTP Flag
Axis2RegistrationClient.java - document/literal Style
org.apache.axis2.rpc.client.RPCServiceClient Class
Axis2GetExchangeRateClient.java - rpc/encoded Style
SocketRequestResponseServer.java - 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