What is a Service Client?

If you try to look at the internals of Axis2 a little bit beyond the generated stubs, you will see the ServiceClient class. Let us look at what it means.

Date: Sun, 30th Nov, 2008
Level: Introductory
Reads: 1479 Comments: 0 | Login or register to post comments
Eran Chinthaka
Software Engineer
WSO2 Inc.
chinthaka's picture

The ServiceClient class, within Axis2, is the client API (Application Programme Interface) to the service being invoked. Each instance of this class is associated with a given service hosted somewhere else on the Web. Methods inside the Service Client class will provide a convenient API to access the operations of the service. These methods correspond to the most commonly used message exchange patterns. For example, the sendReceive method helps to do a synchronous In-Out method invocation and the sendRobust method helps to invoke a Robust In-Only operation.

Some of these methods also provide the option of non-blocking invocations. For example, the sendReceiveNonBlocking method will help to do a asynchronous In-Out method invocation.

In addition to these, the ServiceClient API provides a convenient API to interact with the message and the message context. Using the service client, you can easily add SOAP headers to the outgoing message and also set properties to the message context. Thereby dynamically customizing the internal behavior of the Axis2 engine.

 

Applies To

1. Apache Axis2/Java