1 16 17 package org.apache.axis.transport.java; 18 19 import org.apache.axis.AxisFault; 20 import org.apache.axis.MessageContext; 21 import org.apache.axis.client.Call; 22 import org.apache.axis.components.logger.LogFactory; 23 import org.apache.axis.description.OperationDesc; 24 import org.apache.axis.constants.Scope; 25 import org.apache.axis.handlers.BasicHandler; 26 import org.apache.axis.handlers.soap.SOAPService; 27 import org.apache.axis.providers.java.MsgProvider; 28 import org.apache.axis.providers.java.RPCProvider; 29 import org.apache.commons.logging.Log; 30 31 public class JavaSender extends BasicHandler { 32 protected static Log log = 33 LogFactory.getLog(JavaSender.class.getName()); 34 35 public void invoke(MessageContext msgContext) throws AxisFault { 36 if (log.isDebugEnabled()) { 37 log.debug("Enter: JavaSender::invoke"); 38 } 39 40 SOAPService service = null ; 41 SOAPService saveService = msgContext.getService(); 42 OperationDesc saveOp = msgContext.getOperation(); 43 44 Call call = (Call) msgContext.getProperty( MessageContext.CALL ); 45 String url = call.getTargetEndpointAddress(); 46 String cls = url.substring(5); 47 48 msgContext.setService( null ); 49 msgContext.setOperation( null ); 50 51 if ( msgContext.getProperty(MessageContext.IS_MSG) == null ) 52 service = new SOAPService(new RPCProvider()); 53 else 54 service = new SOAPService(new MsgProvider()); 55 56 if ( cls.startsWith("//") ) cls = cls.substring(2); 57 service.setOption(RPCProvider.OPTION_CLASSNAME, cls); 58 service.setEngine(msgContext.getAxisEngine()); 59 60 service.setOption( RPCProvider.OPTION_ALLOWEDMETHODS, "*" ); 61 service.setOption( RPCProvider.OPTION_SCOPE, Scope.DEFAULT.getName()); 62 service.getInitializedServiceDesc( msgContext ); 63 service.init(); 64 65 msgContext.setService( service ); 66 67 service.invoke( msgContext ); 68 69 msgContext.setService( saveService ); 70 msgContext.setOperation( saveOp ); 71 72 if (log.isDebugEnabled()) { 73 log.debug("Exit: JavaSender::invoke"); 74 } 75 } 76 } 77 | Popular Tags |