12.6.1.3 HTTP Communication



 

Introduction

 

The default implementation for one-way communication is HTTP communication. In a distributed setup, the DMS transfers the network data to the central server as XML packets over HTTP protocol. You can also plug-in XML over HTTPS, or SOAP over HTTP. Default implementations for these are also provided.

 

Default Implementation for HTTP

 

The default implementation for HTTP communication is available in the Distributed Mediation Server and the Central Server at the following locations respectively, <DMS HOME>/default_impl/http_impl and <Central Home>/default_impl/http_impl directories. The implementations at the Distributed Mediation Server are HTTPProbeCommInit and SPPHttpRequest and at the Central Server, the  RegionalListener servlet is present.

...

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

connection = (HttpURLConnection)urlObj.openConnection();

connection.getInputStream();

...

...

...

SPPHttpRequest commImpl = new SPPHttpRequest(serverAddress, serverPort);

return commImpl;

...

 

The initialize() method of SPPHttpRequest constructs the request URL and returns true. The read() method gets the data through the HTTP GET request. The write() method writes the data to the Central Server by posting the data, through the HTTP servlet.

 

...

connection = openConnection(reqURL);

if(connection == null)

{

return null;

}

connection.setRequestMethod("GET");

InputStream res = connection.getInputStream();

 

if(res.available() > 0)

{

ois = new ObjectInputStream(res);

Object object = ois.readObject();

dataObject = (DataObject)object;

}

...

 

 

...

connection = openConnection(url);

if(connection == null)

{

return null;

}

connection.setRequestMethod("POST");

ObjectOutputStream oos = new ObjectOutputStream(connection.getOutputStream());

oos.writeObject(dataObject);

...

 

public void doPost(HttpServletRequest servReq,HttpServletResponse servResp) throws ServletException,IOException

{

....

DataObject dataObj = commApi.transferDataToNOC(dataObject, regionID);

....

}
 

public void doGet(HttpServletRequest req,HttpServletResponse res)throws IOException, ServletException)

{

 ...

      dataObject = commApi.transferDataToReg(regionID);

 ...

}

 

You can refer to the default implementation available in <Central Home>/default_impl/dms/http_impl/fe/RegionalListener.java.

 

Sample Entries in CommunicationInfo.xml

 

In Central

 

...

<Communication>

  <MainProps Mode="1" InitImpl="" MaxBufferSize="25" WriteInterval="" ReadInterval="" />

  </Communication>

...

 

 

In Distributed Mediation Server

 

...

   <Communication>

  <MainProps Mode="1" InitImpl="com.adventnet.nms.extranet.remote.communication.http.probe.HTTPProbeCommInit" MaxBufferSize="25" WriteInterval="300" ReadInterval="5" />

- <UserProps>

  <Property Name="Servlet" Value="/servlet/com.adventnet.nms.extranet.remote.communication.fw.fe.RegionalListener" />

  </UserProps>

  </Communication>

...



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