1 16 17 package test.outparams; 18 19 import org.apache.axis.AxisFault; 20 import org.apache.axis.Message; 21 import org.apache.axis.MessageContext; 22 import org.apache.axis.handlers.BasicHandler; 23 import org.apache.axis.message.RPCElement; 24 import org.apache.axis.message.RPCParam; 25 import org.apache.axis.message.SOAPEnvelope; 26 27 public class ServiceHandler extends BasicHandler { 28 public static final String OUTPARAM1 = "Output param value"; 29 public static final Float OUTPARAM2 = new Float (4.56); 30 public static final Integer RESPONSE = new Integer (5); 31 32 public void invoke(MessageContext msgContext) throws AxisFault { 33 SOAPEnvelope env = new SOAPEnvelope(); 34 35 RPCParam retVal = new RPCParam("return", RESPONSE); 36 RPCParam outParam1 = new RPCParam("out1", OUTPARAM1); 37 RPCParam outParam2 = new RPCParam("out2", OUTPARAM2); 38 39 RPCElement rpc = new RPCElement("namespace", "response", new Object [] 40 { retVal, outParam1, outParam2 }); 41 42 env.addBodyElement(rpc); 43 44 msgContext.setResponseMessage(new Message(env)); 45 } 46 } 47 | Popular Tags |