1 17 package org.apache.geronimo.axis.server; 18 19 import java.lang.reflect.Method ; 20 import javax.xml.rpc.holders.IntHolder ; 21 22 import org.apache.axis.providers.java.RPCProvider; 23 import org.apache.axis.MessageContext; 24 import org.apache.axis.Handler; 25 import org.apache.geronimo.webservices.WebServiceContainer; 26 27 30 public class POJOProvider extends RPCProvider { 31 public POJOProvider() { 32 } 33 34 public Object getServiceObject(MessageContext msgContext, Handler service, String clsName, IntHolder scopeHolder) throws Exception { 35 WebServiceContainer.Request request = (WebServiceContainer.Request) msgContext.getProperty(AxisWebServiceContainer.REQUEST); 36 return request.getAttribute(WebServiceContainer.POJO_INSTANCE); 37 } 38 39 40 protected Object invokeMethod(MessageContext msgContext, Method interfaceMethod, Object pojo, Object [] arguments) throws Exception { 41 Class pojoClass = pojo.getClass(); 42 43 Method pojoMethod = null; 44 try { 45 pojoMethod = pojoClass.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes()); 46 } catch (NoSuchMethodException e) { 47 throw new NoSuchMethodException ("The pojo class '"+pojoClass.getName()+"' does not have a method matching signature: "+interfaceMethod); 48 } 49 50 return pojoMethod.invoke(pojo, arguments); 51 } 52 } 53 | Popular Tags |