Listing 1: Web ServicesDeployment Descriptor file
<deployment xmlns= "http://xml.apache.org/axis/wsdd/"
xmlns:java ="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SampleService" provider="java:RPC">
<parameter name="className" value="com.mydomain.SampleService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
Listing 2: Configure the call object
Call.setOperationName( new Qname("SampleService", "convertcurrencyin") );
call.addParameter( "currency", XMLType.XSD_DOUBLE, ParameterMode.IN);
call.setReturnType(XMLType. XSD_DOUBLE);
Listing 3: SOAP Message
SOAP Message request
<soapenv:Body>
<convertcurrencyin soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<currency xsi:type="xsd:double">4.0</currency>
</convertcurrencyin>
</soapenv: Body>
SOAP Message response
<soapenv:Body>
<convertcurrencyinResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<convertcurrencyinReturn xsi:type="xsd:double">192.0</convertcurrencyinReturn>
</convertcurrencyinResponse>
</soapenv:Body>
Listing 4: Service details
call.setOperationName( new QName("SampleService", "convertcurrencyout") );
call.addParameter( "currency", XMLType.XSD_DOUBLE, ParameterMode.IN);
call.addParameter( "result",XMLType.XSD_DOUBLE,ParameterMode.OUT);
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT);
Double db = new Double(4.0);
Object ret = call.invoke( new Object[] { db} )
Listing 5:
Map outparams = call.getOutputParams();
Set se = outparams.keySet();
Object obj[] = se.toArray();
// iterate this array get the parameter names
// To get the actual value from the service
Collection se1 = outparams.values();
Object obj1[] = se1.toArray();
// // iterate this array get the parameter values
Listing 6: Messages sent and received from SOAP server
SOAP Message request
<soapenv:Body>
<convertcurrencyout soapenv:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/">
<currency xsi:type="xsd:double">4.0</currency>
</convertcurrencyout>
</soapenv:Body>
SOAP Message Response
<soapenv:Body>
<convertcurrencyoutResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<convertcurrencyoutReturn xsi:type="xsd:int">1</convertcurrencyoutReturn>
<result xsi:type="xsd:double">192.0</result>
</convertcurrencyoutResponse>
</soapenv:Body>
Listing 7: Service details
call.setOperationName( new QName("SampleService", "convertcurrencyinout") );
call.addParameter( "currency", XMLType.XSD_DOUBLE, ParameterMode.INOUT);
call.setReturnType( org.apache.axis.encoding.XMLType.XSD_INT);
Double dbinout = new Double(5.0);
call.invoke( new Object[] {dbinout} );
Listing 8
SOAP Message request
<soapenv:Body>
<convertcurrencyinout
soapenv:encodingStyle ="http://schemas.xmlsoap.org/soap/encoding/" >
<currency xsi:type="xsd:double">4.0</currency>
</convertcurrencyinout>
</soapenv:Body>
SOAP Message Response
<soapenv:Body>
<convertcurrencyinoutResponse
soapenv:encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/" >
<convertcurrencyinoutReturn xsi:type="xsd:int">1
</convertcurrencyinoutReturn>
<currency xsi:type="xsd:double">192.0</currency>
</convertcurrencyinoutResponse>
</soapenv:Body>
Listing 9: SOAP Message request
<soapenv:Body>
<getShipmentDetail soapenv:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/">
<orderId xsi:type="xsd:string">ORD_001</orderId>
<getShipmentDetail>
</soapenv:Body>
SOAP Message response
<soapenv:Body>
<ns1:getShipmentDetailResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="SampleService">
<getShipmentDetailReturn xsi:type="xsd:string">ORD_001
</getShipmentDetailReturn>
<result href="#id0"/>
</ns1:getShipmentDetailResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:Address" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:SampleService">
<country xsi:type="xsd:string">INDIA</country>
<street xsi:type="xsd:string">CunninghamRoad</street>
</multiRef>
</soapenv:Body>