AxisOperation op = inMessage.getOperationContext().getAxisOperation();
AxisService service = inMessage.getAxisService();
OMElement methodElement = inMessage.getEnvelope().getBody()
.getFirstElement();
AxisMessage inAxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String messageNameSpace = null;
QName elementQName;
String methodName = op.getName().getLocalPart();
Method[] methods = ImplClass.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(methodName)) {
this.method = methods[i];
break;
}
}
Object resObject = null;
if (inAxisMessage != null) {
if (inAxisMessage.getElementQName() == null) {
// method accept empty SOAPbody
resObject = method.invoke(obj, new Object[0]);
} else {
elementQName = inAxisMessage.getElementQName();
messageNameSpace = elementQName.getNamespaceURI();
OMNamespace namespace = methodElement.getNamespace();
if (messageNameSpace != null) {
if (namespace == null) {
throw new AxisFault("namespace mismatch require " +
messageNameSpace +
" found none");
}
if (!messageNameSpace.equals(namespace.getNamespaceURI())) {
throw new AxisFault("namespace mismatch require " +
messageNameSpace +
" found " + methodElement.getNamespace().getNamespaceURI());
}
} else if (namespace != null) {
throw new AxisFault("namespace mismatch. Axis Oepration expects non-namespace " +
"qualified element. But received a namespace qualified element");
}
Object[] objectArray = RPCUtil.processRequest(methodElement, method,
inMessage.getAxisService().getObjectSupplier());
resObject = method.invoke(obj, objectArray);
}
}
SOAPFactory fac = getSOAPFactory(inMessage);
// Handling the response
AxisMessage outaxisMessage = op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (inAxisMessage != null) {
messageNameSpace = outaxisMessage.getElementQName().getNamespaceURI();
}
OMNamespace ns = fac.createOMNamespace(messageNameSpace,
service.getSchematargetNamespacePrefix());
SOAPEnvelope envelope = fac.getDefaultEnvelope();