Advanced Customization > Info*Engine User’s Guide > SOAP Services > Example Standalone Java SOAP Client > Implementing Tasks and Java Classes
  
Implementing Tasks and Java Classes
For our example, the sum.xml and average.xml tasks are exposed to a standalone SOAP client using the “org.myOrg.Math” class.
* 
For ease of instruction, the tasks used in this sample application are supplied only as examples, and do not represent the types of activities for which Info*Engine tasks are typically written to accomplish.
sum.xml
The sum.xml task takes two integers and returns their sum. The following code is the contents of /org/myOrg.Math/sum.xml:
<%@page language="java"%>
<%@ taglib uri="http://www.ptc.com/infoengine/tag
lib/core"prefix="ie"%>

<!--com.infoengine.soap.rpc.def
this task takes two integers and adds them together
@param int x
@param int y

@return int $(output[]sum[])
-->
<%
Integer x = (Integer)getParam ( "x" );
Integer y = (Integer)getParam ( "y" );
String element = "sum=" + (x.intValue()+y.intValue());
%>

<ie:webject name="Create-Group" type="GRP">
<ie:param name="ELEMENT" data="<%=element%>"/>
<ie:param name="GROUP_OUT" data="output"/>
<ie:webject>
average.xml
The average.xml task takes an array of numbers and returns their average. The following code is the contents of /org/myOrg/Math/average.xml:
<%@page language="java"%>
<%@ taglib uri="http://www.ptc.com/infoengine/tag
lib/core"prefix="ie"%>

<!--com.infoengine.soap.rpc.def
this task takes an array of numbers and averages
them

@param double[]nums

@return double $(output[]avg[])
-->
<%
java.util.Vector nums = getParams ( "nums" );
double sum = 0;
for ( int i = 0; i < nums.size(); i++ )
sum += ((Double)nums.elementAt(i)).doubleValue();
String element = "avg=" + (sum/(double)nums.size());

%><ie:webject name="Create-Group" type="GRP">
<ie:param name="ELEMENT" data="<%=element%>"/>
<ie:param name="GROUP_OUT" data="output"/>
<ie:webject>