Java EE Web Service Client Quality report (v)

Source: Internet
Author: User
Tags command line stub web services

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 ();
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.