1
package test.RPCDispatch;
3
import org.apache.axis.Message;
4
import org.apache.axis.MessageContext;
5
import org.apache.axis.AxisFault;
6
import org.apache.axis.message.RPCElement;
7
import org.apache.axis.utils.DOM2Writer;
8
import org.w3c.dom.Node;
9
import org.w3c.dom.NodeList;
14
public class Service {
17
* Reverse the order of characters in a string
19
public String reverseString(String input) throws Exception {
21
for (int i=input.length(); i>0; ) result+=input.charAt(--i);
26
* Concatenate two strings - used to test out-of-order parameter
29
public String concatenate(String a1, String a2)
35
* Reverse the order of a struct
37
public Data reverseData(Data input) throws Exception {
38
Data result = new Data();
39
result.setField1(input.getField3());
40
result.setField2(reverseString(input.getField2()));
41
result.setField3(input.getField1());
46
* Return the target service (should be this!)
48
public String targetServiceImplicit() throws Exception {
49
return MessageContext.getCurrentContext().getTargetService();
53
* Return the target service (should be this!)
55
public String argAsDOM(Data input) throws Exception {
57
// get the first parameter
58
Message message = MessageContext.getCurrentContext().getRequestMessage();
59
RPCElement body = (RPCElement)message.getSOAPEnvelope().getFirstBody();
60
NodeList parms = body.getAsDOM().getChildNodes();
62
for (int i=0; i<parms.getLength(); i++) {
63
parm1 = parms.item(i);
64
if (parm1.getNodeType() == Node.ELEMENT_NODE) break;
67
// convert it to a DOM and back to a string, and return the result.
68
return DOM2Writer.nodeToString(parm1, true);
73
* Return the value passed (including nulls!)
75
public Integer echoInt(Integer value) throws Exception {
80
* Return the boolean and String arguments concatenated
82
public String overloaded(boolean b, String s)
88
* Return the String and boolean arguments concatenated
90
public String overloaded(String s, boolean b)
96
* Return the boolean value passed in
98
public boolean overloaded(boolean b)
104
* Return the Boolean value passed in
106
public Boolean testBoolean(Boolean b)
112
* Return the Float value passed in
114
public Float testFloat(Float b)
120
* Return the Double value passed in
122
public Double testDouble(Double b)
128
* Return the int passed in (this and the function above test overloaded
131
public int overloaded(int i)
137
* Return the int and String arguments concatenated
139
public String overloaded(int i, String s)
145
* Echo a string array (this is for testing that String->String[]
146
* conversions do NOT happen when using encoded arrays)
148
public void arrayMethod(String [] arg) throws AxisFault {
149
throw new AxisFault("You shouldn't have called me!");
153
* Simple exception to be used in generating faults
155
class TestFault extends Exception {
156
TestFault(String msg) throws Exception {
158
if (msg == null) throw new Exception("default value");
165
public String simpleFault(String value) throws Exception {
166
TestFault fault = new TestFault(value);