de.sagd.u4etx.cis
Class ServiceRequest

java.lang.Object
  |
  +--de.sagd.u4etx.cis.ServiceRequest

public class ServiceRequest
extends java.lang.Object

This is the class you can use to create and send service requests to the entirex broker. It takes a broker object and a service message, sends the message to the broker and provides you an object which encapsulates the response.

Example: list all serves registered at the broker

      // Create a broker object
      Broker broker = new Broker("127.0.0.1:7000", "test");
      broker.logon();

      // Create an InfoServiceMessage and set some values
      InfoServiceMessage info = new InfoServiceMessage();
      info.setInterfaceVersion(InterfaceVersion.VERSION_2);
      info.setBlockLength(new BlockLength(7200));
      info.setObjectType(ObjectType.SERVER);

      // Now we can create and send the request
      ServiceRequest req = new ServiceRequest(broker, info);
      IServiceResponse res = req.sendReceive();

      // We want to display the result to STDOUT
      for (int i = 0; i < res.getCommonHeader().getCurrentNumObjects(); i++) {
          System.out.println("SERVER [" + i + "] : " + res.getServiceResponseObject(i));
      }
 

That's it. You get a list of objects which encapsulates all informations about every server registered at the broker. You can access one object via it's index (res.getServiceResponseObject(i)) and if you know what object type you've used, you can cast the object to the right type:

      ClientServerObject server = (ClientServerObject)res.getServiceResponseObject(0);
      System.out.println(server.getUserID());
      ...
 

Please read the entirex documentation to understand what all theses classes are wrapping. If you have any questions, feel free to contact me at my Software AG's mail address.


Constructor Summary
ServiceRequest(com.softwareag.entirex.aci.Broker oBroker, IServiceMessage oMsg)
          Default constructor.
 
Method Summary
static void main(java.lang.String[] args)
          Used for internet tests only.
 IServiceResponse sendReceive()
          Sends the defined message to the defined broker.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceRequest

public ServiceRequest(com.softwareag.entirex.aci.Broker oBroker,
                      IServiceMessage oMsg)
Default constructor.
Parameters:
oBroker - The broker to talk with.
oMsg - The message to send to the broker.
Method Detail

sendReceive

public IServiceResponse sendReceive()
                             throws ServiceResponseException
Sends the defined message to the defined broker.
Returns:
The response of this request.
Throws:
ServiceResponseException - If something went wrong.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Used for internet tests only.
Parameters:
args - Command line arguments.