dims 2002/10/25 12:54:27
Modified: java/samples/client DynamicInvoker.java readme
java/test/dynamic TestDynamicInvoker.java
Log:
Adding support for doc/lit multiple input parameters.
Note:
java samples.client.DynamicInvoker http://mssoapinterop.org/asmx/xsd/round4XSD.wsdl
echoString "Hello World!!!"
java samples.client.DynamicInvoker
http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathService/VB/MathService.asmx?WSDL
Add 3 4
Revision Changes Path
1.4 +317 -247 xml-axis/java/samples/client/DynamicInvoker.java
Index: DynamicInvoker.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/client/DynamicInvoker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DynamicInvoker.java 24 Oct 2002 22:13:23 -0000 1.3
+++ DynamicInvoker.java 25 Oct 2002 19:54:27 -0000 1.4
@@ -52,16 +52,13 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
package samples.client;
import org.apache.axis.utils.XMLUtils;
-import org.apache.axis.wsdl.gen.Parser;
-import org.apache.axis.wsdl.symbolTable.Type;
-import org.apache.axis.wsdl.symbolTable.Element;
-import org.apache.axis.wsdl.symbolTable.Utils;
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.Parameter;
+import org.apache.axis.wsdl.symbolTable.Parameters;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
-import org.apache.axis.wsdl.symbolTable.TypeEntry;
import org.w3c.dom.Document;
import javax.wsdl.Binding;
@@ -71,10 +68,10 @@
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.Output;
-import javax.wsdl.Part;
import javax.wsdl.Port;
import javax.wsdl.PortType;
import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -88,7 +85,6 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.HashSet;
/**
* This sample shows how to use Axis for completely dynamic invocations
@@ -100,385 +96,450 @@
* @author Alekander Slominski
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
-
public class DynamicInvoker {
+ /**
+ * Method usage
+ */
private static void usage() {
+
System.err.println(
- "Usage: java "
- + DynamicInvoker.class.getName()
- + " wsdlLocation "
+ "Usage: java " + DynamicInvoker.class.getName() + " wsdlLocation "
+ "operationName[(portName)]:[inputMessageName]:[outputMessageName]
"
+ "[argument1 ...]");
System.exit(1);
}
+ /**
+ * Method main
+ *
+ * @param args
+ *
+ * @throws Exception
+ */
public static void main(String[] args) throws Exception {
- if (args.length < 2)
- usage();
- String wsdlLocation = args.length > 0 ? args[0] : null;
- String operationKey = args.length > 1 ? args[1] : null;
+ if (args.length < 2) {
+ usage();
+ }
+ String wsdlLocation = (args.length > 0)
+ ? args[0]
+ : null;
+ String operationKey = (args.length > 1)
+ ? args[1]
+ : null;
String portName = null;
String operationName = null;
String inputName = null;
String outputName = null;
-
StringTokenizer st = new StringTokenizer(operationKey, ":");
int tokens = st.countTokens();
int specType = 0;
+
if (tokens == 2) {
- specType = operationKey.endsWith(":") ? 1 : 2;
- } else if (tokens != 1 && tokens != 3)
+ specType = operationKey.endsWith(":")
+ ? 1
+ : 2;
+ } else if ((tokens != 1) && (tokens != 3)) {
usage();
-
+ }
while (st.hasMoreTokens()) {
- if (operationName == null)
+ if (operationName == null) {
operationName = st.nextToken();
- else if (inputName == null && specType != 2)
+ } else if ((inputName == null) && (specType != 2)) {
inputName = st.nextToken();
- else if (outputName == null)
+ } else if (outputName == null) {
outputName = st.nextToken();
- else
+ } else {
break;
+ }
}
-
try {
portName =
- operationName.substring(operationName.indexOf("(") + 1,
operationName.indexOf(")"));
- operationName = operationName.substring(0, operationName.indexOf("("));
+ operationName.substring(operationName.indexOf("(") + 1,
+ operationName.indexOf(")"));
+ operationName =
+ operationName.substring(0, operationName.indexOf("("));
} catch (Exception ignored) {
}
-
- HashMap map =
- invokeMethod(
- wsdlLocation,
- operationName,
- inputName,
- outputName,
- portName,
- args);
+ HashMap map = invokeMethod(wsdlLocation, operationName, inputName,
+ outputName, portName, args);
// print result
System.out.println("Result:");
for (Iterator it = map.keySet().iterator(); it.hasNext();) {
String name = (String) it.next();
+
System.out.println(name + "=" + map.get(name));
}
System.out.println("\nDone!");
-
}
+ /**
+ * Method invokeMethod
+ *
+ * @param wsdlLocation
+ * @param operationName
+ * @param inputName
+ * @param outputName
+ * @param portName
+ * @param args
+ *
+ * @return
+ *
+ * @throws Exception
+ */
public static HashMap invokeMethod(
- String wsdlLocation,
- String operationName,
- String inputName,
- String outputName,
- String portName,
- String[] args)
+ String wsdlLocation, String operationName, String inputName, String
outputName, String portName, String[] args)
throws Exception {
String serviceNS = null;
String serviceName = null;
String portTypeNS = null;
String portTypeName = null;
- String portNS = null;
String operationQName = null;
System.out.println("Reading WSDL document from '" + wsdlLocation + "'");
- WSDLReader reader = WSDLFactory.newInstance()
- .newWSDLReader();
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+
reader.setFeature("javax.wsdl.verbose", false);
Document doc = XMLUtils.newDocument(wsdlLocation);
Definition def = reader.readWSDL(null, doc);
System.out.println("Preparing Axis dynamic invocation");
-
- Service service = selectService(def, serviceNS, serviceName);
- PortType portType = selectPortType(def, portTypeNS, portTypeName);
-
+ Service service = selectService(def,
+ serviceNS, serviceName);
+ PortType portType = selectPortType(def,
+ portTypeNS,
+ portTypeName);
+ Operation operation = null;
ServiceFactory factory = ServiceFactory.newInstance();
- org.apache.axis.client.Service dpf =
(org.apache.axis.client.Service)factory.createService(new URL(wsdlLocation),
service.getQName());
+ org.apache.axis.client.Service dpf =
+ (org.apache.axis.client.Service) factory.createService(
+ new URL(wsdlLocation), service.getQName());
+
+ if ((inputName == null) && (outputName == null)) {
- if (inputName == null && outputName == null) {
// retrieve list of operations
List operationList = portType.getOperations();
// try to find input and output names for the operation specified
boolean found = false;
+
for (Iterator i = operationList.iterator(); i.hasNext();) {
Operation op = (Operation) i.next();
String name = op.getName();
+
if (!name.equals(operationName)) {
continue;
}
if (found) {
throw new RuntimeException(
- "Operation '"
- + operationName
- + "' is overloaded. "
+ "Operation '" + operationName + "' is overloaded. "
+ "Please specify the operation in the form "
+ "'operationName:inputMessageName:outputMesssageName'
to distinguish it");
}
found = true;
+ operation = op;
Input opInput = op.getInput();
- inputName = (opInput.getName() == null) ? null : opInput.getName();
+
+ inputName = (opInput.getName() == null)
+ ? null
+ : opInput.getName();
Output opOutput = op.getOutput();
- outputName = (opOutput.getName() == null) ? null :
opOutput.getName();
+
+ outputName = (opOutput.getName() == null)
+ ? null
+ : opOutput.getName();
}
}
-
Vector inputs = new Vector();
+ Port port = selectPort(service.getPorts(), portName);
+
if (portName == null) {
- Port port = selectPort(service.getPorts(), portNS, portName);
portName = port.getName();
}
- Call call = dpf.createCall(QName.valueOf(portName),
QName.valueOf(operationName));
-
- // retrieve list of names and types for input and names for output
- List operationList = portType.getOperations();
-
- // find portType operation to prepare in/oout message w/ parts
- boolean found = false;
- String[] outNames = new String[0];
- Class[] outTypes = new Class[0];
- for (Iterator i = operationList.iterator(); i.hasNext();) {
- Operation op = (Operation) i.next();
- String name = op.getName();
- if (!name.equals(operationName)) {
- continue;
- }
- if (found) {
- throw new RuntimeException("overloaded operations are not supported
in this sample");
- }
- found = true;
-
- //System.err.println("op = "+op);
- Input opInput = op.getInput();
-
- // first determine list of arguments
- String[] inNames = new String[0];
- Class[] inTypes = new Class[0];
- if (opInput != null) {
- List parts = opInput.getMessage().getOrderedParts(null);
- int count = parts.size();
- inNames = new String[count];
- inTypes = new Class[count];
- retrieveSignature(dpf, parts, inNames, inTypes);
- }
- // now prepare out parameters
-
- for (int pos = 0; pos < inNames.length; ++pos) {
- String arg = args[pos + 2];
- Object value = null;
- Class c = inTypes[pos];
- if (c.equals(String.class)) {
- value = arg;
- } else if (c.equals(Double.TYPE)) {
- value = new Double(arg);
- } else if (c.equals(Float.TYPE)) {
- value = new Float(arg);
- } else if (c.equals(Integer.TYPE)) {
- value = new Integer(arg);
- } else if (c.equals(Boolean.TYPE)) {
- value = new Boolean(arg);
- } else {
- throw new RuntimeException("not know how to convert '" + arg +
"' into " + c);
- }
-
- inputs.add(value);
- }
-
- Output opOutput = op.getOutput();
- if (opOutput != null) {
- List parts = opOutput.getMessage().getOrderedParts(null);
- int count = parts.size();
- outNames = new String[count];
- outTypes = new Class[count];
- retrieveSignature(dpf, parts, outNames, outTypes);
+ Binding binding = port.getBinding();
+ Call call = dpf.createCall(QName.valueOf(portName),
+ QName.valueOf(operationName));
+
+ // Output types and names
+ Vector outNames = new Vector();
+ Vector outTypes = new Vector();
+
+ // Input types and names
+ Vector inNames = new Vector();
+ Vector inTypes = new Vector();
+ SymbolTable symbolTable = dpf.getWSDLParser().getSymbolTable();
+ BindingEntry bEntry =
+ symbolTable.getBindingEntry(binding.getQName());
+ Parameters parameters = null;
+ Iterator i = bEntry.getParameters().keySet().iterator();
+
+ while (i.hasNext()) {
+ Operation o = (Operation) i.next();
+
+ if (o.getName().equals(operationName)) {
+ parameters = (Parameters) bEntry.getParameters().get(o);
+ }
+ }
+ if ((operation == null) || (parameters == null)) {
+ throw new RuntimeException("no operation " + operationName
+ + " was found in port type "
+ + portType.getQName());
+ }
+
+ // loop over paramters and set up in/out params
+ for (int j = 0; j < parameters.list.size(); ++j) {
+ Parameter p = (Parameter) parameters.list.get(j);
+
+ // Get the QName representing the parameter type
+ QName paramType = org.apache.axis.wsdl.toJava.Utils.getXSIType(p);
+
+ if (p.getMode() == 1) { // IN
+ inNames.add(p.getQName().getLocalPart());
+ addTypeClass(inTypes, paramType.getLocalPart());
+ } else if (p.getMode() == 2) { // OUT
+ outNames.add(p.getQName().getLocalPart());
+ addTypeClass(outTypes, paramType.getLocalPart());
+ } else if (p.getMode() == 3) { // INOUT
+ inNames.add(p.getQName().getLocalPart());
+ addTypeClass(inTypes, paramType.getLocalPart());
+ outNames.add(p.getQName().getLocalPart());
+ addTypeClass(outTypes, paramType.getLocalPart());
+ }
+ }
+
+ // set output type
+ if (parameters.returnParam != null) {
+
+ // Get the QName for the return Type
+ QName returnType = org.apache.axis.wsdl.toJava.Utils.getXSIType(
+ parameters.returnParam);
+ QName returnQName = parameters.returnParam.getQName();
+
+ outNames.add(returnQName.getLocalPart());
+ addTypeClass(outTypes, returnType.getLocalPart());
+ }
+ for (int pos = 0; pos < inNames.size(); ++pos) {
+ String arg = args[pos + 2];
+ Object value = null;
+ Class c = (Class) inTypes.get(pos);
+
+ if (c.equals(String.class)) {
+ value = arg;
+ } else if (c.equals(Double.TYPE)) {
+ value = new Double(arg);
+ } else if (c.equals(Float.TYPE)) {
+ value = new Float(arg);
+ } else if (c.equals(Integer.TYPE)) {
+ value = new Integer(arg);
+ } else if (c.equals(Boolean.TYPE)) {
+ value = new Boolean(arg);
+ } else {
+ throw new RuntimeException("not know how to convert '" + arg
+ + "' into " + c);
}
-
+ inputs.add(value);
}
- if (!found) {
- throw new RuntimeException(
- "no operation "
- + operationName
- + " was found in port type "
- + portType.getQName());
- }
-
System.out.println("Executing operation " + operationName);
Object ret = call.invoke(inputs.toArray());
Map outputs = call.getOutputParams();
-
HashMap map = new HashMap();
- for (int pos = 0; pos < outNames.length; ++pos) {
- String name = outNames[pos];
+
+ for (int pos = 0; pos < outNames.size(); ++pos) {
+ String name = (String) outNames.get(pos);
Object value = outputs.get(name);
- if (value == null && pos == 0)
+ if ((value == null) && (pos == 0)) {
map.put(name, ret);
- else
+ } else {
map.put(name, value);
+ }
}
return map;
}
- private static void retrieveSignature(
- org.apache.axis.client.Service service,
- List parts,
- String[] names,
- Class[] types) {
- // get parts in correct order
- for (int i = 0; i < names.length; ++i) {
- Part part = (Part) parts.get(i);
- names[i] = part.getName();
- QName partTypeName = part.getTypeName();
- QName partElementName = part.getElementName();
- Type partType = null;
- Element partElement = null;
- if (partTypeName != null) {
- partType =
service.getWSDLParser().getSymbolTable().getType(partTypeName);
- // only limited number of types is supported
- // cheerfully ignoring schema namespace ...
- String s = partTypeName.getLocalPart();
- if ("string".equals(s)) {
- types[i] = String.class;
- } else if ("double".equals(s)) {
- types[i] = Integer.TYPE;
- } else if ("float".equals(s)) {
- types[i] = Float.TYPE;
- } else if ("int".equals(s)) {
- types[i] = Integer.TYPE;
- } else if ("boolean".equals(s)) {
- types[i] = Boolean.TYPE;
- }
- } else if (partElementName != null) {
- SymbolTable symbolTable = service.getWSDLParser().getSymbolTable();
- partElement = symbolTable.getElement(partElementName);
- HashSet nestedTypes =
Utils.getNestedTypes(partElement.getRefType(), symbolTable, true);
- Iterator it = nestedTypes.iterator();
- if (it.hasNext()) {
- TypeEntry nestedType = (TypeEntry) it.next();
- // only limited number of types is supported
- // cheerfully ignoring schema namespace ...
- String s = nestedType.getQName().getLocalPart();
- if ("string".equals(s)) {
- types[i] = String.class;
- } else if ("double".equals(s)) {
- types[i] = Integer.TYPE;
- } else if ("float".equals(s)) {
- types[i] = Float.TYPE;
- } else if ("int".equals(s)) {
- types[i] = Integer.TYPE;
- } else if ("boolean".equals(s)) {
- types[i] = Boolean.TYPE;
- }
- }
- } else {
- throw new RuntimeException(
- "part " + names[i] + " must have type or element name
declared");
- }
+ /**
+ * Method addTypeClass
+ *
+ * @param v
+ * @param type
+ */
+ private static void addTypeClass(Vector v, String type) {
+
+ if ("string".equals(type)) {
+ v.add(String.class);
+ } else if ("double".equals(type)) {
+ v.add(Integer.TYPE);
+ } else if ("float".equals(type)) {
+ v.add(Float.TYPE);
+ } else if ("int".equals(type)) {
+ v.add(Integer.TYPE);
+ } else if ("boolean".equals(type)) {
+ v.add(Boolean.TYPE);
+ } else {
+ throw new RuntimeException("Type " + type + " is not supported");
}
}
+ /**
+ * Method selectService
+ *
+ * @param def
+ * @param serviceNS
+ * @param serviceName
+ *
+ * @return
+ *
+ * @throws Exception
+ */
public static Service selectService(
- Definition def,
- String serviceNS,
- String serviceName)
+ Definition def, String serviceNS, String serviceName)
throws Exception {
+
Map services = getAllItems(def, "Service");
- QName serviceQName =
- ((serviceNS != null && serviceName != null)
+ QName serviceQName = (((serviceNS != null) && (serviceName != null))
? new QName(serviceNS, serviceName)
: null);
- Service service =
- (Service) getNamedItem(services, serviceQName, "Service");
+ Service service = (Service) getNamedItem(services, serviceQName,
+ "Service");
+
return service;
}
+ /**
+ * Method selectPortType
+ *
+ * @param def
+ * @param portTypeNS
+ * @param portTypeName
+ *
+ * @return
+ *
+ * @throws Exception
+ */
public static PortType selectPortType(
- Definition def,
- String portTypeNS,
- String portTypeName)
+ Definition def, String portTypeNS, String portTypeName)
throws Exception {
Map portTypes = getAllItems(def, "PortType");
- QName portTypeQName =
- ((portTypeNS != null && portTypeName != null)
+ QName portTypeQName = (((portTypeNS != null)
+ && (portTypeName != null))
? new QName(portTypeNS, portTypeName)
: null);
- PortType portType =
- (PortType) getNamedItem(portTypes, portTypeQName, "PortType");
+ PortType portType = (PortType) getNamedItem(portTypes,
+ portTypeQName, "PortType");
return portType;
}
- public static Port selectPort(
- Map ports,
- String portNS,
- String portName)
- throws Exception {
- QName portQName =
- ((portNS != null && portName != null)
- ? new QName(portNS, portName)
- : null);
- Port port =
- (Port) getNamedItem(ports, portQName, "Port");
- return port;
+ /**
+ * Method selectPort
+ *
+ * @param ports
+ * @param portName
+ *
+ * @return
+ *
+ * @throws Exception
+ */
+ public static Port selectPort(Map ports, String portName) throws Exception {
+ Iterator valueIterator = ports.keySet().iterator();
+
+ while (valueIterator.hasNext()) {
+ String name = (String) valueIterator.next();
+
+ if ((portName == null) || (portName.length() == 0)) {
+ Port port = (Port) ports.get(name);
+ List list = port.getExtensibilityElements();
+
+ for (int i = 0; (list != null) && (i < list.size()); i++) {
+ Object obj = list.get(i);
+
+ if (obj instanceof SOAPAddress) {
+ return port;
+ }
+ }
+ }
+ if ((name != null) && name.equals(portName)) {
+ return (Port) ports.get(name);
+ }
+ }
+ return null;
}
+ /**
+ * Method getNamedItem
+ *
+ * @param items
+ * @param qname
+ * @param itemType
+ *
+ * @return
+ *
+ * @throws Exception
+ */
public static Object getNamedItem(Map items, QName qname, String itemType)
throws Exception {
+
if (qname != null) {
Object item = items.get(qname);
if (item != null) {
return item;
} else {
- throw new Exception(
- itemType
- + " '"
- + qname
- + "' not found. Choices are: "
- + getCommaListFromQNameMap(items));
+ throw new Exception(itemType + " '" + qname
+ + "' not found. Choices are: "
+ + getCommaListFromQNameMap(items));
}
} else {
int size = items.size();
if (size >= 1) {
Iterator valueIterator = items.values().iterator();
-
Object o = valueIterator.next();
return o;
} else if (size == 0) {
- throw new Exception(
- "WSDL document contains no " + itemType + "s.");
+ throw new Exception("WSDL document contains no " + itemType
+ + "s.");
} else {
- throw new Exception(
- "Please specify a "
- + itemType
- + ". Choices are: "
- + getCommaListFromQNameMap(items));
+ throw new Exception("Please specify a " + itemType
+ + ". Choices are: "
+ + getCommaListFromQNameMap(items));
}
}
}
+ /**
+ * Method getCommaListFromQNameMap
+ *
+ * @param qnameMap
+ *
+ * @return
+ */
private static String getCommaListFromQNameMap(Map qnameMap) {
+
StringBuffer strBuf = new StringBuffer("{");
Set keySet = qnameMap.keySet();
Iterator keyIterator = keySet.iterator();
int index = 0;
while (keyIterator.hasNext()) {
- strBuf.append((index > 0 ? ", " : "") + keyIterator.next());
+ strBuf.append(((index > 0)
+ ? ", "
+ : "") + keyIterator.next());
index++;
}
strBuf.append("}");
return strBuf.toString();
}
- public static void addDefinedItems(
- Map fromItems,
- String itemType,
- Map toItems) {
-
+ /**
+ * Method addDefinedItems
+ *
+ * @param fromItems
+ * @param itemType
+ * @param toItems
+ */
+ public static void addDefinedItems(Map fromItems, String itemType,
+ Map toItems) {
if (fromItems != null) {
Iterator entryIterator = fromItems.entrySet().iterator();
@@ -529,10 +590,15 @@
}
}
- private static void getAllItems(
- Definition def,
- String itemType,
- Map toItems) {
+ /**
+ * Method getAllItems
+ *
+ * @param def
+ * @param itemType
+ * @param toItems
+ */
+ private static void getAllItems(Definition def, String itemType,
+ Map toItems) {
Map items = null;
if (itemType.equals("PortType")) {
@@ -540,12 +606,10 @@
} else if (itemType.equals("Service")) {
items = def.getServices();
} else {
- throw new IllegalArgumentException(
- "Don't know how to find all " + itemType + "s.");
+ throw new IllegalArgumentException("Don't know how to find all "
+ + itemType + "s.");
}
-
addDefinedItems(items, itemType, toItems);
-
Map imports = def.getImports();
if (imports != null) {
@@ -573,11 +637,17 @@
}
}
+ /**
+ * Method getAllItems
+ *
+ * @param def
+ * @param itemType
+ *
+ * @return
+ */
public static Map getAllItems(Definition def, String itemType) {
Map ret = new HashMap();
-
getAllItems(def, itemType, ret);
return ret;
}
-
}
1.2 +2 -0 xml-axis/java/samples/client/readme
Index: readme
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/client/readme,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- readme 13 Oct 2002 15:35:58 -0000 1.1
+++ readme 25 Oct 2002 19:54:27 -0000 1.2
@@ -16,3 +16,5 @@
Finally, to run the client, run:
java samples.client.DynamicInvoker
http://www.xmethods.net/sd/2001/TemperatureService.wsdl getTemp 02067
java samples.client.DynamicInvoker
http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl getQuote IBM
+ java samples.client.DynamicInvoker
http://mssoapinterop.org/asmx/xsd/round4XSD.wsdl echoString "Hello World!!!"
+ java samples.client.DynamicInvoker
http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathService/VB/MathService.asmx?WSDL
Add 3 4
1.4 +21 -0 xml-axis/java/test/dynamic/TestDynamicInvoker.java
Index: TestDynamicInvoker.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/dynamic/TestDynamicInvoker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestDynamicInvoker.java 24 Oct 2002 22:13:23 -0000 1.3
+++ TestDynamicInvoker.java 25 Oct 2002 19:54:27 -0000 1.4
@@ -119,4 +119,25 @@
throw new junit.framework.AssertionFailedError("Remote Exception
caught: " + re);
}
}
+
+ public void test4() throws Exception {
+ try {
+ String[] args = new
String[]{"http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathService/VB/MathService.asmx?WSDL",
+ "Add",
+ "3",
+ "4"};
+ DynamicInvoker invoker = new DynamicInvoker();
+ invoker.main(args);
+ } catch (java.rmi.RemoteException re) {
+ if (re instanceof AxisFault) {
+ AxisFault fault = (AxisFault) re;
+ if (fault.detail instanceof ConnectException ||
+ fault.getFaultCode().getLocalPart().equals("HTTP")) {
+ System.err.println("TerraService HTTP error: " + fault);
+ return;
+ }
+ }
+ throw new junit.framework.AssertionFailedError("Remote Exception
caught: " + re);
+ }
+ }
}