You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/02/16 07:00:37 UTC
svn commit: r154001 - in
webservices/axis/trunk/java/dev/scratch/prototype2/src:
samples/encoding/sample2/src/META-INF/
samples/encoding/sample2/src/benchmark1/ test/org/apache/axis/testUtils/
Author: ajith
Date: Tue Feb 15 22:00:34 2005
New Revision: 154001
URL: http://svn.apache.org/viewcvs?view=rev&rev=154001
Log:
Added a byte array decoder. its still not functioning properly.
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/META-INF/service.xml
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/BenchProvider.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1Impl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1PortType.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/META-INF/service.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/META-INF/service.xml?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/META-INF/service.xml (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/META-INF/service.xml Tue Feb 15 22:00:34 2005
@@ -4,10 +4,13 @@
<operation name="echoStrings" qname="echoStrings" style="anyStyle" use="anyUse"/>
<operation name="echoInts" qname="echoInts" style="anyStyle" use="anyUse"/>
<operation name="echoDoubles" qname="echoDoubles" style="anyStyle" use="anyUse"/>
+ <operation name="echoBase64" qname="echoBase64" style="anyStyle" use="anyUse"/>
<operation name="receiveStrings" qname="receiveStrings" style="anyStyle" use="anyUse"/>
<operation name="receiveInts" qname="receiveInts" style="anyStyle" use="anyUse"/>
<operation name="receiveDoubles" qname="receiveDoubles" style="anyStyle" use="anyUse"/>
+ <operation name="receiveBase64" qname="receiveBase64" style="anyStyle" use="anyUse"/>
<operation name="sendStrings" qname="sendStrings" style="anyStyle" use="anyUse"/>
<operation name="sendInts" qname="sendInts" style="anyStyle" use="anyUse"/>
<operation name="sendDoubles" qname="sendDoubles" style="anyStyle" use="anyUse"/>
+ <operation name="sendBase64" qname="sendBase64" style="anyStyle" use="anyUse"/>
</service>
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/BenchProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/BenchProvider.java?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/BenchProvider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/BenchProvider.java Tue Feb 15 22:00:34 2005
@@ -60,7 +60,9 @@
objs[i] = SimpleTypeEncodingUtils.deserializeDoubleArray(xpp);
} else if (int[].class.equals(parms[i])) {
objs[i] = SimpleTypeEncodingUtils.deserializeIntArray(xpp);
- } else {
+ } else if (byte[].class.equals(parms[i])) {
+ objs[i] = SimpleTypeEncodingUtils.deserializeByteArray(xpp);
+ }else {
throw new UnsupportedOperationException("Only int,String and String[] is supported yet");
}
}
@@ -104,20 +106,27 @@
result = benchmark.echoInts((int[])parms[0]);
}else if ("echoDoubles".equals(methodName)) {
result = benchmark.echoDoubles((double[])parms[0]);
+ }else if ("echoBase64".equals(methodName)) {
+ result = benchmark.echoBase64((byte[])parms[0]);
}else if ("receiveStrings".equals(methodName)) {
result = new Integer(benchmark.receiveStrings((String[])parms[0]));
} else if ("receiveInts".equals(methodName)) {
result = new Integer(benchmark.receiveInts((int[])parms[0]));
} else if ("receiveDoubles".equals(methodName)) {
result = new Integer(benchmark.receiveDoubles((double[])parms[0]));
+ }else if ("receiveBase64".equals(methodName)) {
+ result = new Integer(benchmark.receiveBase64((byte[])parms[0]));
} else if ("sendStrings".equals(methodName)) {
result = benchmark.sendStrings(((Integer)parms[0]).intValue());
} else if ("sendInts".equals(methodName)) {
result = benchmark.sendInts(((Integer)parms[0]).intValue());
}else if ("sendDoubles".equals(methodName)) {
result = benchmark.sendDoubles(((Integer)parms[0]).intValue());
+ }else if ("sendBase64".equals(methodName)) {
+ result = benchmark.sendBase64(((Integer)parms[0]).intValue());
}
+
Encoder outobj = null;
Class clazz = result.getClass();
@@ -128,7 +137,8 @@
clazz == int[].class ||
clazz == double.class ||
clazz == Double.class ||
- clazz == double[].class ) {
+ clazz == double[].class ||
+ clazz == byte[].class) {
outobj = new SimpleTypeEncoder(result);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1Impl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1Impl.java?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1Impl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1Impl.java Tue Feb 15 22:00:34 2005
@@ -11,9 +11,9 @@
public void echoVoid() throws java.rmi.RemoteException {
}
-// public byte[] echoBase64(byte[] input) throws java.rmi.RemoteException {
-// return input;
-// }
+ public byte[] echoBase64(byte[] input) throws java.rmi.RemoteException {
+ return input;
+ }
public java.lang.String[] echoStrings(java.lang.String[] input) throws java.rmi.RemoteException {
return input;
@@ -28,9 +28,9 @@
}
-// public int receiveBase64(byte[] input) throws java.rmi.RemoteException {
-// return input.length;
-// }
+ public int receiveBase64(byte[] input) throws java.rmi.RemoteException {
+ return input.length;
+ }
public int receiveStrings(String[] input) throws java.rmi.RemoteException {
return input.length;
@@ -44,14 +44,14 @@
return input.length;
}
-// public byte[] sendBase64(int n) throws java.rmi.RemoteException {
-// byte[] output = new byte[n];
-// for (int i = 0; i < n; i++)
-// {
-// output[i] = (byte) i;
-// }
-// return output;
-// }
+ public byte[] sendBase64(int n) throws java.rmi.RemoteException {
+ byte[] output = new byte[n];
+ for (int i = 0; i < n; i++)
+ {
+ output[i] = (byte) i;
+ }
+ return output;
+ }
public String[] sendStrings(int n) throws java.rmi.RemoteException {
String[] output = new String[n];
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1PortType.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1PortType.java?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1PortType.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/encoding/sample2/src/benchmark1/Benchmark1PortType.java Tue Feb 15 22:00:34 2005
@@ -17,7 +17,7 @@
/**
* echos base64 content
*/
- //public byte[] echoBase64(byte[] input) throws java.rmi.RemoteException;
+ public byte[] echoBase64(byte[] input) throws java.rmi.RemoteException;
/**
* echos string arrays
@@ -37,7 +37,7 @@
/**
* receives base64 content
*/
- //public int receiveBase64(byte[] input) throws java.rmi.RemoteException;
+ public int receiveBase64(byte[] input) throws java.rmi.RemoteException;
/**
* receives strings
@@ -57,7 +57,7 @@
/**
* sends base64 content
*/
- //public byte[] sendBase64(int size) throws java.rmi.RemoteException;
+ public byte[] sendBase64(int size) throws java.rmi.RemoteException;
/**
* sends strings
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncoder.java Tue Feb 15 22:00:34 2005
@@ -83,7 +83,12 @@
cHandler.endElement(OMConstants.ARRAY_ITEM_NSURI, OMConstants.ARRAY_ITEM_LOCALNAME, OMConstants.ARRAY_ITEM_QNAME);
}
- } else {
+
+ }else if(obj.getClass() == byte[].class){
+ byte[] byteArray = (byte[])obj;
+ str = new String(byteArray).toCharArray();
+ cHandler.characters(str,0,str.length);
+ }else{
throw new OMException("Unsupported type");
}
} catch (SAXException e) {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java?view=diff&r1=154000&r2=154001
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/testUtils/SimpleTypeEncodingUtils.java Tue Feb 15 22:00:34 2005
@@ -26,6 +26,16 @@
public class SimpleTypeEncodingUtils {
+ public static byte[] deserializeByteArray(XMLStreamReader xpp)
+ throws AxisFault {
+ String val = deserializeString(xpp);
+ if (val == null) {
+ throw new AxisFault("Null recieved!!");
+ }
+ return val.getBytes();
+
+
+ }
public static String[] deserializeStringArray(XMLStreamReader xpp)
throws AxisFault {