You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2001/07/02 18:11:07 UTC
cvs commit: xml-axis/java/samples/echo EchoService.java deploy.xml TestClient.java
rubys 01/07/02 09:11:06
Modified: java/samples/echo TestClient.java
Added: java/samples/echo EchoService.java deploy.xml
Log:
Axis implementation of the Echo interoperability tests.
Note: client for Base64 still forthcoming.
Revision Changes Path
1.8 +21 -12 xml-axis/java/samples/echo/TestClient.java
Index: TestClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/TestClient.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestClient.java 2001/06/29 19:58:38 1.7
+++ TestClient.java 2001/07/02 16:11:04 1.8
@@ -56,7 +56,7 @@
package samples.echo ;
import java.lang.reflect.Array;
-import java.util.Hashtable;
+import java.util.Date;
import org.apache.axis.AxisFault ;
import org.apache.axis.client.ServiceClient ;
@@ -83,7 +83,8 @@
private static String soapAction = "http://soapinterop.org/";
/**
- *
+ * Determine if two objects are equal. Handles nulls and recursively
+ * verifies arrays are equal.
*/
private static boolean equals(Object obj1, Object obj2) {
if (obj1 == null) return (obj2 == null);
@@ -107,24 +108,30 @@
String method = "echo" + type;
String arg = "input" + type;
String resultName = "output" + type;
- RPCParam paramToSend = new RPCParam(arg, toSend);
+
try {
- // Default return type based on what we expect
- ServiceDescription sd = new ServiceDescription(method, true);
- sd.addOutputParam(resultName, map.getTypeQName(toSend.getClass()));
- sd.addOutputParam("Return", map.getTypeQName(toSend.getClass()));
- call.setServiceDescription(sd);
+ // set up the argument list
+ Object args[];
+ if (toSend == null) {
+ args = new Object[] {};
+ } else {
+ args = new Object[] {new RPCParam(arg, toSend)};
+
+ // Default return type based on what we expect
+ ServiceDescription sd = new ServiceDescription(method, true);
+ sd.setOutputParam(map.getTypeQName(toSend.getClass()));
+ call.setServiceDescription(sd);
+ }
+ // set the SOAPAction, optionally appending the method name
String action = soapAction;
- if (addMethodToAction) {
- action += method;
- }
+ if (addMethodToAction) action += method;
call.set(HTTPTransport.ACTION, action);
// issue the request
Object gotBack = call.invoke(
- "http://soapinterop.org/", method, new Object[] {paramToSend} );
+ "http://soapinterop.org/", method, args);
// verify the result
if (equals(toSend,gotBack)) {
@@ -176,6 +183,8 @@
new SOAPStruct(1, "one", 1.1F),
new SOAPStruct(2, "two", 2.2F),
new SOAPStruct(3, "three", 3.3F)});
+ test("Void", null);
+ test("Date", new Date());
}
}
1.1 xml-axis/java/samples/echo/EchoService.java
Index: EchoService.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package samples.echo ;
import java.util.*;
/**
* Test implementation of the echo interop service. Original description of
* this was found at http://www.xmethods.net/ilab/ . The current definition
* can be found at http://www.whitemesa.com/interop.htm .
*
* @author Sam Ruby <ru...@us.ibm.com>
*/
public class EchoService {
/**
* This method accepts a single string and echoes it back to the client.
*/
public String echoString(String input) {
return input;
}
/**
* This method accepts an array of strings and echoes it back to the client.
*/
public String[] echoStringArray(String[] input) {
return input;
}
/**
* This method accepts an single integer and echoes it back to the client.
*/
public Integer echoInteger(Integer input) {
return input;
}
/**
* This method accepts an array of integers and echoes it back to the
* client.
*/
public Integer[] echoIntegerArray(Integer[] input) {
return input;
}
/**
* This method accepts a single float and echoes it back to the client.
*/
public Float echoFloat(Float input) {
return input;
}
/**
* This method accepts an array of floats and echoes it back to the client.
*/
public Float[] echoFloatArray(Float[] input) {
return input;
}
/**
* This method accepts a single structure and echoes it back to the
* client.
*/
public SOAPStruct echoStruct(SOAPStruct input) {
return input;
}
/**
* This method accepts an array of structures and echoes it back to the
* client. The structure used is the same defined in the description of
* the "echoStruct" method.
*/
public SOAPStruct[] echoStructArray(SOAPStruct[] input) {
return input;
}
/**
* This method exists to test the "void" return case. It accepts no
* arguments, and returns no arguments.
*/
public void echoVoid() {
}
/**
* This methods accepts a binary object and echoes it back to the client.
*/
public byte[] echo(byte[] input) {
return input;
}
/**
* This method accepts a Date/Time and echoes it back to the client.
*/
public Date echoDate(Date input) {
return input;
}
}
1.1 xml-axis/java/samples/echo/deploy.xml
Index: deploy.xml
===================================================================
<!-- Use this file to deploy some handlers/chains and services -->
<!-- Two ways to do this: -->
<!-- java org.apache.axis.utils.Admin deploy.xml -->
<!-- from the same dir that the Axis engine runs -->
<!-- or -->
<!-- java org.apache.axis.client.http.AdminClient deploy.xml -->
<!-- after the axis server is running -->
<!-- This file will be replaced by WSDD once it's ready -->
<m:deploy xmlns:m="AdminService">
<chain name="echo" flow="RPCDispatcher" />
<service name="http://soapinterop.org/" pivot="echo" >
<option name="className" value="samples.echo.EchoService" />
<option name="methodName" value="*" />
</service>
<bean xmlns:echo="http://soapinterop.org/xsd">
<echo:SOAPStruct classname="samples.echo.SOAPStruct"/>
</bean>
</m:deploy>