| 1 |
/* |
| 2 |
* Copyright 2001-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 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 |
} |