12.6.1.4 SOAP Over HTTP



 

What is SOAP?

 

The W3C defines SOAP as " a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment. It uses XML technologies to define an extensible messaging framework providing a message construct that can be exchanged over a variety of underlying protocols. The framework has been designed to be independent of any particular programming model and other implementation specific semantics".

 

For further references on  SOAP and its advantages, check http://www.w3.org/TR/SOAP/.

 

What is AXIS?

 

Axis is a third-party framework for constructing SOAP processors such as clients, servers etc. It can be plugged into servlet engines such as Tomcat.

 

For further references on Axis, check http://ws.apache.org/axis/java/user-guide.html.

 

Prerequisites

 

You must have installed Axis 'Add-on'.

 

Steps to Apply Axis 'Add-on'

 

Axis being a third-party software, is not bundled with the product by default. You need to install the Axis 'Add-on'. This 'Add-on' in the form of a .ppm file,  contains the required jars. This .ppm file also takes care of the required configuration changes for setting the mode of data transfer to SOAP over HTTP.

 

In the Central Server, the relevant jars are placed in <Central Home>/apache/tomcat/webapps/axis/WEB-INF/lib directory. In the Distributed Mediation Server(s) , the jars are extracted in <DMS Home>/classes directory.
 

To download the Add-on, contact nms-support@adventnet.com.

 

The corresponding classes for SOAP implementation are available in the product by default.

 

Default Implementation for SOAP

 

A default implementations for SOAP over HTTP is available. The details are listed below:

 

Component

 

Class Name

Directory

Package Structure

Central Server

SOAPService

<Central Home>/classes

com.adventnet.nms.extranet.remote.communication.soap.fe.SOAPService

Distributed Mediation Server

SOAPClient

<DMS Home>/classes

com.adventnet.nms.extranet.remote.communication.soap.probe.SOAPClient

 

SOAPClientCommInit

<DMS Home>/classes

 

Common

ObjectUtil

<DMS Home>/classes

com.adventnet.nms.extranet.remote.communication.soap.ObjectUtil

 

The SOAPClientCommInit implementation is present in the Distributed Mediation Server and establishes connection with the Central Server. This class implements SPPCommInitIfc,  and the open() method is used to establish connection. If establishing connection is not successful, then CommunicationException is displayed.

 

...

 

URL urlObj = new URL("http://"+serverAddress+":"+serverPort+servlet);

connection = (HttpURLConnection)urlObj.openConnection();

connection.getInputStream();

...

 

 

The SOAPClient class implements SPPRegionalCommIfc and contains the methods initialize(), read(), and write(). This class is responsible for establishing communication with the Central Server with the specified host server address and the server port.

 

The initialize() method constructs the request URL and returns true. The read() gets the data as shown below

 

...

...

Object obj = get(dob,url);

...

return (DataObject)ObjectUtil.getObject((byte[])obj);

...

 

The write() method writes the data to the Central Server.

 

...

...

Object obj = send(dob,url);

...

return (DataObject)ObjectUtil.getObject((byte[])obj);

...

 

 

The Axis framework reads the url specified to determine the target address to which the data must be sent from the DMS. The Object data and the String url are passed as arguments to the send() method.

 

The SOAPService  class accepts the data and returns the response.

 

 

The ObjectUtil is a utility class common to the Central Server and the DMS. Instances of  ByteArrayOutputStream and ObjectOutputStream are created in ObjectUtil class, which takes care of transforming the data that is received as byte array into objects.

 

...

...

ByteArrayOutputStream bos = new ByteArrayOutputStream();

ObjectOutputStream oos = new ObjectOutputStream(bos);

oos.writeObject(obj);

...

...

byte [] data = bos.toByteArray();

return data;

...

...

 

 

Changes in the Configuration Files

 

The Axis Add-on also contains the required configuration changes. So, once the Add-on is applied, the mode of data transfer and the default protocol will be SOAP over HTTP. Manual changes in the configuration file is not required. The updated configuration files are:

Changes in CommunicationInfo.xml

 

The change in the configuration file is the value for the InitImpl parameter, which contains the name of  initialization implementation interface. The entry in the configuration file is as shown below:

 

<Communication>

    <MainProps Mode="2" InitImpl="com.adventnet.nms.extranet.remote.communication.soap.probe.SOAPClientCommInit" MaxBufferSize="25" WriteInterval="-1" ReadInterval="-1"/>

    <UserProps>

</UserProps>

</Communication>

 

Changes in mod_jk.conf-auto

 

Following entry is  added in this configuration file.

 

JkMount /axis/* ajp13

 

 

 



Copyright © 1996-2004, AdventNet Inc. All Rights Reserved.