I am developing a test message-style AXIS client & server and notice that the client takes about 8 seconds for the client to instantiate the Service class on an IBM RS6000 AIX4.3 machine. Is this quite normal or am I doing something wrong? I used the provided sample code for message-style clients to create mine. Below is the code. Appreciate any insight in this.
---------------------------------------------------------------------------------------------------------------------------
package ping.client;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.apache.axis.client.*;
import org.apache.axis.message.*;
import org.apache.axis.utils.*;
import java.io.*;
import java.text.*;
import java.net.URL;
import java.util.*;
public class pingClient {
public void sendIt(String args[]) throws Exception {
String endpointURL = "http://"+args[0]+":8080/axis/services/pingService";
// Create Call object (via Service) to call server
// ****** This statement takes 8 seconds to complete *************
Service sv = new Service();
Call call = (Call) sv.createCall();
call.setTargetEndpointAddress(new URL(endpointURL));
// Create a SOAP body elements to send to server
SOAPBodyElement[] Selems = new SOAPBodyElement[2];
// Build DOM Document via Factory and builder
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = fact.newDocumentBuilder();
// Now create DOM doc to use for creating DOM elements
Document DOMdoc = builder.newDocument();
// Create SOAP element using DOM doc
Element ping = DOMdoc.createElementNS("cnf:dms","PING");
org.w3c.dom.Text pingdata = DOMdoc.createTextNode("are you there?");
ping.appendChild(pingdata);
Selems[0] = new SOAPBodyElement(ping);
// Create SOAP element using XMLUtils
Selems[1] = new SOAPBodyElement(XMLUtils.StringToElement("cnf:dms",
"PONG","let me know"));
// Call the sever
Vector resp = (Vector) call.invoke(Selems);
// Get SOAP elemements and DOM elements
SOAPBodyElement retSOAPel = null;
Element retDOMel = null;
for (int i = 0; i<resp.size();i++) {
retSOAPel = (SOAPBodyElement) resp.get(i);
retDOMel = retSOAPel.getAsDOM();
System.out.println("Element "+i+": "+XMLUtils.ElementToString(retDOMel));
}
}
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.out.println("Bad Host");
System.exit(1);
}
(new pingClient()).sendIt(args);
}
} // End of class
