|
Hi, I am trying to convert our web service application from axis
to axis2. I have a handler to do the authorization based on the object passed
in. Previously when using Axis, I retrieved ‘RPCElement’
and ‘RPCParam’ objects from OMElement and do the following: ---------------------------------------------------------------- import org.apache.axis.AxisFault; import org.apache.axis.MessageContext; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.message.RPCElement; import org.apache.axis.message.RPCParam; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.transport.http.HTTPConstants; import org.xml.sax.SAXException; void doAuthorization(SOAPEnvlope envlope){
// retrieve the soap envelope Vector bodyElements = null; Enumeration e0 = null;
bodyElements = envlope.getBodyElements(); while (e0.hasMoreElements())
{
// recurse through the soap body and retrieve the
// rpc elements, the rpc elements contain the
// embeded objects which were returned from the service
RPCElement rpcElement = (RPCElement)
e0.nextElement();
Vector params = rpcElement.getParams();
Enumeration e1 = params.elements();
while (e1.hasMoreElements()) {
RPCParam rpcParam = (RPCParam) e1.nextElement();
Object param
= null;
param = rpcParam.getObjectValue();
if(param instanceof SOME_SERVICE_OBJ) {
// perform some service authorization
// ...
}
else {
// do nothing
}
} } } ------------------------------------------------------------------------------- Now in Axis2, I cannot find any similar RPC classes which are as convenient
as “RPCElement” and “RPCParam” in axis. With help of such
classes, we can easily retrive RPCParam’s object value (might be a very complex
structure) from SOAP message and do some sort of authorization based on its
object value’s runtime class (seeing the red highlighted part of the
code.) Any idea? Any help is highly appreciated. Liping
|
