>
> 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>&nbsp;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>&nbsp;</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>&nbsp;</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>&nbsp;</div>
> <div>Thank you so much, </div>
> <div>Daniela</div>
> <div>&nbsp;</div>
> <div>
> <p>public class
> TestPerformanceExecutionAxisWS{<br>&nbsp;<br>&nbsp;<br>&nbsp;public static
> void main(String args[]){<br>&nbsp;&nbsp;String url[] = new
> String[4];<br>&nbsp;&nbsp;url[0] =&quot;<a href="
> http://localhost:8080/webservices/EscalierBeton.jws";>
> http://localhost:8080/webservices/EscalierBeton.jws</a>&quot;;<br>
> &nbsp;&nbsp;url[1] =&quot;<a href="
> http://localhost:8080/webservices/FournitureBetonENT2.jws";>
> http://localhost:8080/webservices/FournitureBetonENT2.jws</a>&quot;;<br>&nbsp;&nbsp;url[2]
> =&quot;<a href="http://localhost:8080/webservices/FournitureBois.jws";>
> http://localhost:8080/webservices/FournitureBois.jws</a>&quot;;<br>
> &nbsp;&nbsp;url[3] =&quot;<a href="
> http://localhost:8080/webservices/FournitureFerENT.jws";>
> http://localhost:8080/webservices/FournitureFerENT.jws</a>&quot;;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;String
> method&nbsp;&nbsp;&nbsp;&nbsp; =
> &quot;executeWS&quot;;<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;int n=0;<br>
> &nbsp;&nbsp;long startTime =
> System.currentTimeMillis();<br>&nbsp;&nbsp;long
> averageWS=0;<br>&nbsp;&nbsp;for (int i = 0;
> i&lt;400;i++){<br>&nbsp;&nbsp;&nbsp;try{<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;long
> startWS =
> System.currentTimeMillis();&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;ExecuteWSviaAxis
> oExecuteWS = new ExecuteWSviaAxis(url[n],method);<br>
> &nbsp;&nbsp;&nbsp;&nbsp;n++;<br>&nbsp;&nbsp;&nbsp;&nbsp;if (n==3)
> n=0;<br>&nbsp;&nbsp;&nbsp;&nbsp;String result =
> oExecuteWS.executeWS();<br>&nbsp;&nbsp;&nbsp;&nbsp;long finalWS =
> System.currentTimeMillis();<br>&nbsp;&nbsp;&nbsp;&nbsp;long totalWS =
> finalWS-startWS;<br>&nbsp;&nbsp;&nbsp;&nbsp;averageWS =
> averageWS+totalWS;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;}catch(Exception
> e){<br>
> &nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;long
> finalTime = System.currentTimeMillis();&nbsp;<br>&nbsp;&nbsp;long totalTime
> = finalTime -
> startTime;<br>&nbsp;&nbsp;System.out.println(&quot;***************************&quot;);<br>&nbsp;&nbsp;System.out.println(&quot;TOTAL
> TIME:&quot;+totalTime);<br>
> &nbsp;&nbsp;System.out.println(&quot;AVERAGE
> TIME:&quot;+averageWS/400);<br>&nbsp;}<br>}</p>
> <p>&nbsp;</p>
> <p>/**<br>*ExecuteWSviaAxis&nbsp; <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&nbsp; {<br>&nbsp;String
> endpoint;<br>&nbsp;String method;<br>&nbsp;<br>&nbsp;public
> ExecuteWSviaAxis(String urlService, String
> method){<br>&nbsp;&nbsp;this.endpoint =
> urlService;<br>&nbsp;&nbsp;this.method = method;<br>&nbsp;}<br>&nbsp;&nbsp;
> <br>
> &nbsp;&nbsp;&nbsp; public String executeWS() throws
> Exception{<br>&nbsp;&nbsp;&nbsp; &nbsp;String
> result=&quot;&quot;;<br>&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;
> &nbsp;&nbsp;try{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service&nbsp;
> service = new Service();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> Call&nbsp;&nbsp;&nbsp;&nbsp; call&nbsp;&nbsp;&nbsp; = (Call)
> service.createCall();<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> call.setTargetEndpointAddress( new java.net.URL(endpoint) );<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call.setOperationName( method
> );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call.setReturnType(
> XMLType.XSD_STRING
> );<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;***********&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;*********** Starting Web service with AXIS
> ******************&quot;);<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;*********** Service
> endpoint:&quot;+endpoint);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> result = (String) call.invoke(new Object []
> {});<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;*********** Finishing Web service with AXIS
> ******************&quot;);<br>
> &nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;***********&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> System.out.println(&quot;ResultadoServiceAxis:&quot; +
> result);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }catch(Exception
> e){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;System.out.println(&quot;ERRO AXIS
> Method:prepareServiceToExecution inside MPExecution:&quot;);<br>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
> result;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;
> }<br>}<br></p>
> <p>&nbsp;</p>
> <p>&nbsp;</p>
> <p>&nbsp;</p>
> <p>&nbsp;</p></div>
>
> ------=_Part_16260_23665717.1207008796319--
>



-- 
--
ProfÂȘ DrÂȘ Daniela Barreiro Claro
Pesquisadora no LASID/DCC/UFBA
Salvador - Bahia - Brasil

Reply via email to