Q5.
(a) Briefly discuss the meaning of handlers and chains in the context of AXIS
architecture. Give three examples of built-in handlers in AXIS. Briefly
discuss their functions.
(8 marks)
(b) The following shows the WSDD file for a SOAP service:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="MyServiceName" provider="java:RPC">
<parameter name="className" value="eie424.MyService"/>
<parameter name="allowedMethods" value="method1"/>
</service>
</deployment>
Based on the information given in the file, answer the following:
(i) What is the name of the function that is exposed to the client?
(ii) What is the name of the service?
(iii) AXIS supports Web services of either performing a remote procedure
call or just simply passing messages between client and server. From
the file above, what kind of service is provided? How do you know?
(iv) Give the WSDD file that allows us to un-deploy the service as
mentioned in the WSDD file above.
(6 marks)
(c) Fig.Q5a shows a program that runs in a client machine for invoking a remote
SOAP service. In the program, two messages will be passed to the remote
service and a string will be received if the remote function is executed
successfully. Modify the program such that rather than sending two messages
to the remote service, a Javabean that contains the two messages as shown in
Fig.Q5b will be sent. When defining the QName of the Javabean, you can set
the namespace of the Javabean to urn:messageBean. Besides, the QName for
String is org.apache.axis.encoding.XMLType.XSD_STRING.
(11 marks)
package eie424;
import
import
import
import
import
import
import
import
org.apache.axis.AxisFault;
org.apache.axis.client.Call;
org.apache.axis.client.Service;
org.apache.axis.utils.Options;
org.apache.axis.encoding.ser.BeanSerializerFactory;
org.apache.axis.encoding.ser.BeanDeserializerFactory;
javax.xml.namespace.QName;
javax.xml.rpc.ParameterMode;
public class Client1 {
public static void main(String args[]) {
try {
String endpoint =
“http://158.132.100.100:8080/axis/services/MessageServices";
String message1 = "EIE 424";
String message2 = "SOAP LAB";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("messageProcessor",
"messenger"));
String ret = (String) call.invoke(new Object[]{message1,
message2});
System.out.println(ret);
} catch (Exception e) {e.printStackTrace(); }
}
}
Fig.Q5a
package eie424;
public class Messages
{
private String MessA;
private String MessB;
public
public
public
public
String getMessA() { return MessA; }
void setMessA(String message1) { MessA = message1; }
String getMessB() { return MessB;}
void setMessB(String message2) { MessB = message2;}
}
Fig.Q5b
(a)
A Handler is responsible for some specific processing associated with an input, output, or fault flow.
It can be used to encrypt/decrypt message headers and the message body, to process digital signature
headers, etc.
A Chain is a sequence of Handlers in order to jointly carry out a function. AXIS
provides the flexibility to freely insert different Handlers to a Chain to suit different applications.
Three example handlers
– De-Serializer: This handler parses the InputStream into XML and uses various decoding schemes
to convert XML into a format native to the programming language underlying the Axis processing
node
– Canonicalizer: This handler is responsible for getting the information on where/how to return the
response message. The canonicalizer handler also creates the output message to be forwarded to
the dispatcher
– Router: This handler determines the service details like the service name and operation from the
incoming request message
(b) (i)
The function name is method1.
(b) (ii)
The name of the service is MyServiceName.
(b) (iii)
RPC, since provider = java:RPC.
(b) (iv)
<undeployment xmlns="http://xml.apache.org/axis/wsdd/">
<service name="MyServiceName" />
</undeployment>
(c)
package eie424;
import
import
import
import
import
import
import
import
org.apache.axis.AxisFault;
org.apache.axis.client.Call;
org.apache.axis.client.Service;
org.apache.axis.utils.Options;
org.apache.axis.encoding.ser.BeanSerializerFactory;
org.apache.axis.encoding.ser.BeanDeserializerFactory;
javax.xml.namespace.QName;
javax.xml.rpc.ParameterMode;
public class Client1 {
public static void main(String args[]) {
Messages mess = new Messages();
mess.setMessA("EIE424");
mess.setMessB(“SOAP LAB”);
QName qn = new QName( “urn:messageBean", "Messages");
try {
String endpoint =
“http://158.132.100.100:8080/axis/services/MessageServices";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("messageProcessor", "messenger"));
call.addParameter("Input-parameter", qn, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.registerTypeMapping(Messages.class, qn,
new BeanSerializerFactory(Messages.class, qn),
new BeanDeserializerFactory(Messages.class, qn));
String ret = (String) call.invoke(new Object[]{Mess});
System.out.println(ret);
} catch (Exception e) {e.printStackTrace(); }
}
}
The lines underlined should be added to the original program.
© Copyright 2026 Paperzz