Java API

The Java API allows you to direct RPC client calls to Java objects instead of to target servers via HTTP(s). A special configuration is required to call Java objects; see Configuration File. The Start Script is also different. From the RPC client point of view, usage is the same.


Properties File

The Java API uses the same Properties File as the RPC Server for XML/SOAP.

Configuration File

The Java API uses the same Configuration File as the RPC Server for XML/SOAP.

The services (programs) directed to the Java interface of the RPC Server for XML/SOAP have to use a special keyword xmlrpcServerClass as the value of the name attribute in the TargetServer block. A mixture of target servers using HTTP(S) and Java objects is possible.

Example:

<?xml version="1.0" encoding="UTF-8" ?>
<EntireX
xmlns="http://namespaces.softwareag.com/entirex/xml/runtime/configuration"
version="10.1"
>
<XmlRuntime Version="1">
<BrokerInfo>
<BrokerId>localhost:1971</BrokerId>
<ServerAddress>RPC/SRV1/CALLNAT</ServerAddress>
</BrokerInfo>
<TargetServer name="xmlrpcServerClass">
<xmms>
<exx-xmm name="java-service1.xmm" />
<exx-xmm name="java-service2.xmm" />
<exx-xmm name="java-service3.xmm" />
</xmms>
</TargetServer>
<TargetServer name="http://myWebService">
<xmms>
<exx-xmm name="http-service1.xmm" />
<exx-xmm name="http-service2.xmm" />
</xmms>
</TargetServer>
</XmlRuntime>
</EntireX>

Implementation of the Java API for the RPC Server for XML/SOAP

The Java API requires a user-written Java class initializing the RPC Server for XML/SOAP and implementing the XMLRPCServerInterface.

Example:

import java.util.Properties;
import com.softwareag.entirex.xml.rt.XMLRPCServerInterface;
import com.softwareag.entirex.xml.rt.XMLRPCServer;
public class MyXMLRPCServer implements XMLRPCServerInterface
{
  public MyXMLRPCServer ()
  {
    XMLRPCServer xmlRpcServer = new XMLRPCServer();
    // register your implementation of XMLRPCServerInterface
    xmlRpcServer. registerXMLRPCServerClass ((XMLRPCServerInterface) this);
    // start RPC Server for XML/SOAP with arguments (same as command line)
    xmlRpcServer.start(new String[0]);
  }

  // mandatory method invoke (from XMLRPCServerInterface)
  // - thread synchronization must be done by application if required
  // - properties object contains property "charset" (as used in xml-declaration)
  // and property "java.charset" - the corresponding Java codepage
  // - Exception thrown from this method is mapped to error class 2000 and error number 200,
  //   with exception information in errortext

  public byte[] invoke(byte[] requestDocument, Properties properties)
    throws Exception
  {
    byte[] response = null;
    // TODO <insert application code here>
    return response;
  }

  public static void main(String[] args)
  {
    MyXMLRPCServer myServer = new MyXMLRPCServer ();
  }
}

Start Script

The RPC Server for XML/SOAP with Java API must be started by implementing XMLRPCServerInterface as in this example:

java  -classpath "%PARSER%;%CLASSPATH%" MyXMLRPCServer