Hi,
Just to confirm what you are doing.
Machine 1 ( Axis SOAP client ) ---------> TCP/IP HTTP SOAP
-------------> Machine 2 ( SOAP Server )
Your example endpont address uses localhost
h ttp://localhost:8080/webservices/EscalierBeton.jws
<http://localhost:8080/webservices/EscalierBeton.jws>
I assume the cross machine test is:
h ttp://machine2:8080/webservices/EscalierBeton.jws
<http://machine2:8080/webservices/EscalierBeton.jws>
1. You could have a slow DNS lookup to resolve the domain name to IP address
If you are using Windows on Machine 1 you could add the domain name to the
hosts file for a test
Example: C:\WINNT\system32\drivers\etc\hosts
2. You could write a simple Java program that creates a Socket connect to
the Machine 2 and POSTs a prepared SOAP message. ( This is eliminate the
Axis client )
Socket socket = new Socket ( machine2:8080 )
OutputStream o = socket.getOutputStream
o.write ( HTTP protocol )
o.write ( SOAP content )
InputStream input = socket.getInputStream
read input
socket.close ()
-----Original Message-----
From: Daniela Claro [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 2 April 2008 12:03 AM
To: [email protected]
Subject: WS Performance
Hi all,
I am using Axis to develop Web services, but until right now I was using
all WS locally. It took about 22milleseconds to execute. Very fast. However
I put them in a LAN, within two machines, and the same Web service took
about 4000 miliseconds to execute. I was astonished! What am I doing wrong?
I put in annexe my Test class in java so you can see what I am actually
doing to run all of them. All four Web services has only one method that
returns OK as a String when it is executed, nothing more than this.
Thus I would like to know what shall I do to make my WS more faster. I am
using axis 1.3.
Thank you so much,
Daniela
public class TestPerformanceExecutionAxisWS{
public static void main(String args[]){
String url[] = new String[4];
url[0] =" http://localhost:8080/webservices/EscalierBeton.jws
<http://localhost:8080/webservices/EscalierBeton.jws> ";
url[1] =" http://localhost:8080/webservices/FournitureBetonENT2.jws
<http://localhost:8080/webservices/FournitureBetonENT2.jws> ";
url[2] =" http://localhost:8080/webservices/FournitureBois.jws
<http://localhost:8080/webservices/FournitureBois.jws> ";
url[3] =" http://localhost:8080/webservices/FournitureFerENT.jws
<http://localhost:8080/webservices/FournitureFerENT.jws> ";
String method = "executeWS";
int n=0;
long startTime = System.currentTimeMillis();
long averageWS=0;
for (int i = 0; i<400;i++){
try{
long startWS = System.currentTimeMillis();
ExecuteWSviaAxis oExecuteWS = new ExecuteWSviaAxis(url[n],method);
n++;
if (n==3) n=0;
String result = oExecuteWS.executeWS();
long finalWS = System.currentTimeMillis();
long totalWS = finalWS-startWS;
averageWS = averageWS+totalWS;
}catch(Exception e){
e.printStackTrace();
}
}
long finalTime = System.currentTimeMillis();
long totalTime = finalTime - startTime;
System.out.println("***************************");
System.out.println("TOTAL TIME:"+totalTime);
System.out.println("AVERAGE TIME:"+averageWS/400);
}
}
/**
*ExecuteWSviaAxis
*/
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import javax.xml.rpc.ParameterMode;
public class ExecuteWSviaAxis {
String endpoint;
String method;
public ExecuteWSviaAxis(String urlService, String method){
this.endpoint = urlService;
this.method = method;
}
public String executeWS() throws Exception{
String result="";
try{
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName( method );
call.setReturnType( XMLType.XSD_STRING );
System.out.println("***********");
System.out.println("*********** Starting Web service with AXIS
******************");
System.out.println("*********** Service endpoint:"+endpoint);
result = (String) call.invoke(new Object [] {});
System.out.println("*********** Finishing Web service with AXIS
******************");
System.out.println("***********");
System.out.println("ResultadoServiceAxis:" + result);
}catch(Exception e){
System.out.println("ERRO AXIS Method:prepareServiceToExecution
inside MPExecution:");
}
return result;
}
}