>
> 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";
> url[1] ="http://localhost:8080/webservices/FournitureBetonENT2.jws";
> url[2] ="http://localhost:8080/webservices/FournitureBois.jws";
> url[3] ="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;
>
> }
> }
>
> ------=_Part_16260_23665717.1207008796319
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
>
> <div>Hi all, </div>
> <div> 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? </div>
>
> <div> </div>
> <div>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.
> </div>
>
> <div> </div>
> <div>Thus I would like to know what shall I do to make my WS more faster.
> I am using axis 1.3. </div>
> <div> </div>
> <div>Thank you so much, </div>
> <div>Daniela</div>
> <div> </div>
> <div>
> <p>public class
> TestPerformanceExecutionAxisWS{<br> <br> <br> public static
> void main(String args[]){<br> String url[] = new
> String[4];<br> url[0] ="<a href="
> http://localhost:8080/webservices/EscalierBeton.jws">
> http://localhost:8080/webservices/EscalierBeton.jws</a>";<br>
> url[1] ="<a href="
> http://localhost:8080/webservices/FournitureBetonENT2.jws">
> http://localhost:8080/webservices/FournitureBetonENT2.jws</a>";<br> url[2]
> ="<a href="http://localhost:8080/webservices/FournitureBois.jws">
> http://localhost:8080/webservices/FournitureBois.jws</a>";<br>
> url[3] ="<a href="
> http://localhost:8080/webservices/FournitureFerENT.jws">
> http://localhost:8080/webservices/FournitureFerENT.jws</a>";<br> <br> String
> method =
> "executeWS";<br> <br> int n=0;<br>
> long startTime =
> System.currentTimeMillis();<br> long
> averageWS=0;<br> for (int i = 0;
> i<400;i++){<br> try{<br> <br> long
> startWS =
> System.currentTimeMillis(); <br> ExecuteWSviaAxis
> oExecuteWS = new ExecuteWSviaAxis(url[n],method);<br>
> n++;<br> if (n==3)
> n=0;<br> String result =
> oExecuteWS.executeWS();<br> long finalWS =
> System.currentTimeMillis();<br> long totalWS =
> finalWS-startWS;<br> averageWS =
> averageWS+totalWS;<br> <br> }catch(Exception
> e){<br>
> e.printStackTrace();<br> }<br> <br> }<br> long
> finalTime = System.currentTimeMillis(); <br> long totalTime
> = finalTime -
> startTime;<br> System.out.println("***************************");<br> System.out.println("TOTAL
> TIME:"+totalTime);<br>
> System.out.println("AVERAGE
> TIME:"+averageWS/400);<br> }<br>}</p>
> <p> </p>
> <p>/**<br>*ExecuteWSviaAxis <br>*/</p>
> <p><br>import org.apache.axis.client.Call;<br>import
> org.apache.axis.client.Service;<br>import
> org.apache.axis.encoding.XMLType;<br>import
> org.apache.axis.utils.Options;</p>
> <p>import javax.xml.rpc.ParameterMode;</p>
> <p>public class ExecuteWSviaAxis {<br> String
> endpoint;<br> String method;<br> <br> public
> ExecuteWSviaAxis(String urlService, String
> method){<br> this.endpoint =
> urlService;<br> this.method = method;<br> }<br>
> <br>
> public String executeWS() throws
> Exception{<br> String
> result="";<br> <br>
> try{<br> Service
> service = new Service();<br>
> Call call = (Call)
> service.createCall();<br> <br>
> call.setTargetEndpointAddress( new java.net.URL(endpoint) );<br>
> call.setOperationName( method
> );<br>
> <br> call.setReturnType(
> XMLType.XSD_STRING
> );<br> <br>
> System.out.println("***********");<br>
> System.out.println("*********** Starting Web service with AXIS
> ******************");<br>
>
> System.out.println("*********** Service
> endpoint:"+endpoint);<br>
> result = (String) call.invoke(new Object []
> {});<br>
> System.out.println("*********** Finishing Web service with AXIS
> ******************");<br>
>
> System.out.println("***********");<br>
> <br>
> System.out.println("ResultadoServiceAxis:" +
> result);<br>
> <br> }catch(Exception
> e){<br>
> System.out.println("ERRO AXIS
> Method:prepareServiceToExecution inside MPExecution:");<br>
>
> <br>
> }<br>
> <br>
> <br> return
> result;<br> <br>
> }<br>}<br></p>
> <p> </p>
> <p> </p>
> <p> </p>
> <p> </p></div>
>
> ------=_Part_16260_23665717.1207008796319--
>
--
--
ProfÂȘ DrÂȘ Daniela Barreiro Claro
Pesquisadora no LASID/DCC/UFBA
Salvador - Bahia - Brasil