Class ImplClass = obj.getClass();
DependencyManager.configureBusinussLogicProvider(obj,msgContext);
OperationDescription op = msgContext.getOperationContext().getAxisOperation();
if (op == null) {
throw new AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
}
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;
}
}
Class[] parameters = method.getParameterTypes();
if ((parameters != null)
&& (parameters.length == 1)
&& OMElement.class.getName().equals(parameters[0].getName())) {
OMElement methodElement = msgContext.getEnvelope().getBody().getFirstElement();
OMElement parmeter = null;
SOAPEnvelope envelope = null;
String style = msgContext.getOperationContext().getAxisOperation().getStyle();
if (WSDLService.STYLE_DOC.equals(style)) {
parmeter = methodElement;
Object[] parms = new Object[] { parmeter };
// invoke the WebService
OMElement result = (OMElement) method.invoke(obj, parms);
envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
envelope.getBody().setFirstChild(result);
} else if (WSDLService.STYLE_RPC.equals(style)) {
parmeter = methodElement.getFirstElement();
Object[] parms = new Object[] { parmeter };
// invoke the WebService
OMElement result = (OMElement) method.invoke(obj, parms);
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
envelope = fac.getDefaultEnvelope();
OMNamespace ns = fac.createOMNamespace("http://soapenc/", "res");
OMElement responseMethodName = fac.createOMElement(methodName + "Response", ns);
if (result != null) {
responseMethodName.addChild(result);
}
if (responseMethodName != null) {
envelope.getBody().addChild(responseMethodName);
}
} else {
throw new AxisFault("Unknown style ");
}
} else {
throw new AxisFault(
"Raw Xml provider supports only the methods bearing the signature public OMElement "
+ "<method-name>(OMElement) where the method name is anything");
}
} catch (Exception e) {
throw AxisFault.makeFault(e);