Establish sample client application
To establish a sample client application, add the following file system to the IDE: /metrics/transactionclient.
The file system contains an application class and a XACT package. The application class mimics the execution of client transactions, and the Xact package contains the client Web service processor.
The XACT package can be created using the Sun Web Services Developer Toolkit, which is included in the Sun one application framework. Batch files Gen.bat use the Wscompile command to create XACT packages. If you want to rebuild the package, you just need to adjust the environment variable and the URL in the Config.xml it uses. However, if you do so, you have to rewrite the line of code added to the stub class Web method, which you will use to overwrite the original line of code.
Let's take a look at Xactclientapp, sample client application class:
Import xact.*
Import javax.xml.rpc.Stub
Import payload.*
public class Xactclientapp {
/** Cre Ates a new instance of Xactclientapp */
Public Xactclientapp () {
}
/**
* @param args the command line Argu ments
*/
public static void Main (string[] args) {
try {
int cyclesperxact = 1;
int numberxacts = 5;
String TransactionID = "";
String transactiontype =
String.valueof (cyclesperxact) + "submit,check,gets";
stub = Createproxy ();
Xactserviceservantinterface xact = (xactserviceservantinterface) Stub;
Currentreport cr = new Currentreport ();
for (int x=1; x<= numberxacts;x++) {
Cr. BeginTransaction ();
for (int i=1; i<=cyclesperxact;i++) {
TransactionID = xact.submitwork ("New Transaction");
System.out.println ("Transaction:" + TransactionID);
Boolean unused = Xact.checkwork (TransactionID);
String ignore = Xact.getresult (TransacTionid);
}
Cr.committransaction (TransactionID, Transactiontype, "success");
}
catch (Exception ex) {
Ex.printstacktrace ();
}
private static Stub Createproxy () {
return (Stub) (New Xactservice_impl ()). Getxactserviceservantinterfac Eport ();
}
}