scheu 02/02/15 11:41:17
Modified: java/samples/echo EchoService.java SOAPArrayStruct.java
SOAPStructStruct.java TestClient.java deploy.wsdd
java/src/javax/xml/rpc/namespace QName.java
java/src/org/apache/axis/encoding/ser ArraySerializer.java
java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
JavaWriter.java SchemaUtils.java SymTabEntry.java
SymbolTable.java Utils.java
java/test/utils TestQName.java
java/test/wsdl Wsdl2javaTestSuite.xml
Log:
Changes are made to support the Round2B Interop Tests.
Most of the changes are related to the client samples.echo.TestClient
to invoke the Round2B operations.
-----------------------------------------------------
You should notice the Round 2B results in the grid
the next time the interop tests are run.
-----------------------------------------------------
Detailed Summary of Changes:
1) Change EchoService to properly receive and echo a String[][]
for the echo2DStringArray method. (Was String[].)
2) Made cosmetic changes to EchoService to change the
parameter names to match the xml schema description.
3) Added equals() and toString() methods to SOAPArrayStruct and
SOAPStructStruct classes to allow TestClient to verify
echo'ed objects of these classes.
4) Changed the TestClient to use stub code instead of dii to
call the services. This change was made due to the
complexity of the new methods.
5) Stub files and other client side artifacts were generated
and are checked in. Some changes were made to the
code to support the existing TestClient behavior.
In the future, I would like to move to a more
automated approach.
6) Changed TestClient to add calls/verification of the
Round 2B interop methods. I ran Sam's script and
it appears that Axis is conforming!
7) Some changes to the deploy.wsdd file.
8) Improved the implementation of javax.xml.rpc.namespace.QName.
(I also noticed that the current code is out-of-date with
the spec and will need to be changed!)
9) Changed WSDL2Java stub writer to fix a problem with
hex binary.
10) The echo2DString array revealed two problems in WSDL2Java
related to interpretting multi-dimensional arrayType values.
These are now fixed.
11) Axis serializes String[][] using an "array of array of string"
style. The echo2DStringArray method requires a "xsd:string[2,2]"
style. (I did a test and only 2 services accepted the first format
while 6 services accepted the second format.) As a result
I enabled the code in ArraySerializer which will serialize
the array using the "xsd:string[2,2]" style when appropriate.
Revision Changes Path
1.17 +16 -21 xml-axis/java/samples/echo/EchoService.java
Index: EchoService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/EchoService.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- EchoService.java 12 Feb 2002 20:22:03 -0000 1.16
+++ EchoService.java 15 Feb 2002 19:41:16 -0000 1.17
@@ -93,42 +93,42 @@
skel.add("echoString",
new String[] {
"return",
- "input"
+ "inputString"
});
skel.add("echoStringArray",
new String[] {
"return",
- "input"
+ "inputStringArray"
});
skel.add("echoInteger",
new String[] {
"return",
- "input"
+ "inputInteger"
});
skel.add("echoIntegerArray",
new String[] {
"return",
- "input"
+ "inputIntegerArray"
});
skel.add("echoFloat",
new String[] {
"return",
- "input"
+ "inputFloat"
});
skel.add("echoFloatArray",
new String[] {
"return",
- "input"
+ "inputFloatArray"
});
skel.add("echoStruct",
new String[] {
"return",
- "input"
+ "inputStruct"
});
skel.add("echoStructArray",
new String[] {
"return",
- "input"
+ "inputStructArray"
});
skel.add("echoVoid",
new String[] {
@@ -136,42 +136,37 @@
skel.add("echoBase64",
new String[] {
"return",
- "input"
+ "inputBase64"
});
skel.add("echoHexBinary",
new String[] {
"return",
- "input"
+ "inputHexBinary"
});
skel.add("echoDate",
new String[] {
"return",
- "input"
+ "inputDate"
});
skel.add("echoDecimal",
new String[] {
"return",
- "input"
- });
- skel.add("echoMapArray",
- new String[] {
- "return",
- "input"
+ "inputDecimal"
});
skel.add("echoBoolean",
new String[] {
"return",
- "input"
+ "inputBoolean"
});
skel.add("echoMap",
new String[] {
"return",
- "input"
+ "inputMap"
});
skel.add("echoMapArray",
new String[] {
"return",
- "input"
+ "inputMapArray"
});
skel.add("echoStructAsSimpleTypes",
new String[] {
@@ -335,7 +330,7 @@
return s ;
}
- public java.lang.String[] echo2DStringArray(java.lang.String[]
input2DStringArray) {
+ public java.lang.String[][] echo2DStringArray(java.lang.String[][]
input2DStringArray) {
return input2DStringArray ;
}
1.2 +43 -0 xml-axis/java/samples/echo/SOAPArrayStruct.java
Index: SOAPArrayStruct.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/SOAPArrayStruct.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPArrayStruct.java 10 Feb 2002 02:23:53 -0000 1.1
+++ SOAPArrayStruct.java 15 Feb 2002 19:41:16 -0000 1.2
@@ -109,4 +109,47 @@
public void setVarArray(java.lang.String[] varArray) {
this.varArray = varArray;
}
+
+ /**
+ * Equality comparison.
+ */
+ public boolean equals(Object object) {
+ if (!(object instanceof SOAPArrayStruct)) return false;
+
+ SOAPArrayStruct that= (SOAPArrayStruct) object;
+
+ if (this.varInt != that.varInt) return false;
+ if (this.varFloat != that.varFloat) return false;
+
+ if (this.varString == null) {
+ if (that.varString != null) return false;
+ } else {
+ if (!this.varString.equals(that.varString)) return false;
+ }
+
+ if (this.varArray == null) {
+ if (that.varArray != null) return false;
+ } else if (this.varArray.length != that.varArray.length) {
+ return false;
+ } else {
+ for (int i=0; i <this.varArray.length; i++) {
+ if (this.varArray[i] == null) {
+ if (that.varArray[i] != null) {
+ return false;
+ }
+ } else if (!this.varArray[i].equals(that.varArray[i])) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ };
+
+ /**
+ * Printable representation
+ */
+ public String toString() {
+ return "{" + varInt + ", \"" + varString + "\", " + varFloat + ", " +
varArray +"}";
+ }
}
1.2 +33 -0 xml-axis/java/samples/echo/SOAPStructStruct.java
Index: SOAPStructStruct.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/SOAPStructStruct.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPStructStruct.java 10 Feb 2002 02:23:53 -0000 1.1
+++ SOAPStructStruct.java 15 Feb 2002 19:41:16 -0000 1.2
@@ -109,4 +109,37 @@
public void setVarStruct(SOAPStruct varStruct) {
this.varStruct = varStruct;
}
+
+ /**
+ * Equality comparison.
+ */
+ public boolean equals(Object object) {
+ if (!(object instanceof SOAPStructStruct)) return false;
+
+ SOAPStructStruct that= (SOAPStructStruct) object;
+
+ if (this.varInt != that.varInt) return false;
+ if (this.varFloat != that.varFloat) return false;
+
+ if (this.varString == null) {
+ if (that.varString != null) return false;
+ } else {
+ if (!this.varString.equals(that.varString)) return false;
+ }
+
+ if (this.varStruct == null) {
+ if (that.varStruct != null) return false;
+ } else {
+ if (!this.varStruct.equals(that.varStruct)) return false;
+ }
+
+ return true;
+ };
+
+ /**
+ * Printable representation
+ */
+ public String toString() {
+ return "{" + varInt + ", \"" + varString + "\", " + varFloat + ", " +
varStruct+ "}";
+ }
}
1.52 +242 -107 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.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- TestClient.java 14 Feb 2002 22:46:34 -0000 1.51
+++ TestClient.java 15 Feb 2002 19:41:16 -0000 1.52
@@ -80,6 +80,11 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.rpc.holders.StringHolder;
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.FloatHolder;
+
+
/**
* Test Client for the echo interop service. See the main entrypoint
* for more details on usage.
@@ -88,13 +93,9 @@
*/
public abstract class TestClient {
- private static Service service;
- private static Call call;
private static boolean addMethodToAction = false;
private static String soapAction = "http://soapinterop.org/";
-
- private TypeMappingRegistry tmr;
- private TypeMapping tm;
+ private static EchoServicePortType binding = null;
/**
* Determine if two objects are equal. Handles nulls and recursively
@@ -147,73 +148,17 @@
}
/**
- * Test an echo method. Declares success if the response returns
- * true with an Object.equal comparison with the object to be sent.
- * @param method name of the method to invoke
- * @param toSend object of the correct type to be sent
- */
- private void test(String type, Object toSend) {
- String method = "echo" + type;
-
- type = type.trim();
-
- String arg = "input" + type;
- String resultName = "output" + type;
-
-
- try {
- // set up the argument list
- Object args[];
- call.removeAllParameters();
- if (toSend == null) {
- args = new Object[] {};
- } else {
- // args = new Object[] {new RPCParam(arg, toSend)};
-
- // Default return type based on what we expect
- QName qn = tm.getTypeQName(toSend.getClass());
-
- call.addParameter( arg, qn, ParameterMode.PARAM_MODE_IN);
- call.setReturnType( qn );
- args = new Object[] { toSend } ;
- }
-
- // set the SOAPAction, optionally appending the method name
- String action = soapAction;
- if (addMethodToAction) action += method;
- call.setUseSOAPAction( true );
- call.setSOAPActionURI( action );
-
- // safety first
- call.setTimeout(new Integer(60000));
-
- // issue the request
- call.setOperationName( new QName("http://soapinterop.org/",
method.trim()) );
- Object got= call.invoke( args );
-
- // verify the result
- verify(method, toSend, got);
-
- } catch (AxisFault af) {
- verify(method, toSend, af);
- } catch (Exception e) {
- verify(method, toSend, e);
- }
- }
-
- /**
* Set up the call object.
*/
public void setURL(String url)
throws AxisFault
{
try {
- service = new Service();
- call = (Call) service.createCall();
- call.setTargetEndpointAddress( new java.net.URL(url) );
- tmr = call.getMessageContext().getTypeMappingRegistry();
- }
- catch( Exception exp ) {
+ binding = new EchoServiceAccessLocator().
+ getEchoServicePortType(new java.net.URL(url));
+ ((EchoServiceBindingStub) binding).soapAction = soapAction;
+ ((EchoServiceBindingStub) binding).addMethodToAction =
addMethodToAction;
+ } catch (Exception exp) {
throw AxisFault.makeFault(exp);
}
}
@@ -222,56 +167,246 @@
* Execute the tests
*/
public void execute() throws Exception {
- // register the SOAPStruct class
- QName ssqn = new QName("http://soapinterop.org/xsd", "SOAPStruct");
- Class cls = SOAPStruct.class;
- call.registerTypeMapping(cls, ssqn, BeanSerializerFactory.class,
BeanDeserializerFactory.class);
-
- // Register deserializer factories for the array types.
- // AXIS doesn't use the array types during serialization,
- // so there is no need to register the serializer factories.
- QName q = new QName("http://soapinterop.org/xsd", "ArrayOfSOAPStruct");
- Class c = SOAPStruct[].class;
- call.registerTypeMapping(c,q, null, ArrayDeserializerFactory.class);
- q = new QName("http://soapinterop.org/xsd", "ArrayOfstring");
- c = java.lang.String[].class;
- call.registerTypeMapping(c,q, null, ArrayDeserializerFactory.class);
- q = new QName("http://soapinterop.org/xsd", "ArrayOffloat");
- c = float[].class;
- call.registerTypeMapping(c,q, null, ArrayDeserializerFactory.class);
- q = new QName("http://soapinterop.org/xsd", "ArrayOfint");
- c = int[].class;
- call.registerTypeMapping(c,q, null, ArrayDeserializerFactory.class);
- tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
-
// execute the tests
- test("String ", "abcdefg");
- test("StringArray ", new String[] {"abc", "def"});
- test("Integer ", new Integer(42));
- test("IntegerArray", new int[] {42});
- test("Float ", new Float(3.7F));
- test("FloatArray ", new float[] {3.7F, 7F});
- test("Struct ", new SOAPStruct(5, "Hello", 10.3F));
- test("StructArray ", new SOAPStruct[] {
- new SOAPStruct(1, "one", 1.1F),
- new SOAPStruct(2, "two", 2.2F),
- new SOAPStruct(3, "three", 3.3F)});
- test("Void ", null);
- test("Base64 ", "Base64".getBytes());
- test("HexBinary ", new Hex("3344"));
- test("Date ", new Date());
- test("Decimal ", new BigDecimal("3.14159"));
- test("Boolean ", Boolean.TRUE);
+ Object output = null;
+
+ {
+ String input = "abccdefg";
+ try {
+ output = binding.echoString(input);
+ verify("echoString", input, output);
+ } catch (Exception e) {
+ verify("echoString", input, e);
+ }
+ }
+
+ {
+ String[] input = new String[] {"abc", "def"};
+ try {
+ output = binding.echoStringArray(input);
+ verify("echoStringArray", input, output);
+ } catch (Exception e) {
+ verify("echoStringArray", input, e);
+ }
+ }
+
+ {
+ Integer input = new Integer(42);
+ try {
+ output = new Integer( binding.echoInteger(input.intValue()));
+ verify("echoInteger", input, output);
+ } catch (Exception e) {
+ verify("echoInteger", input, e);
+ }
+ }
+
+ {
+ int[] input = new int[] {42};
+ try {
+ output = binding.echoIntegerArray(input);
+ verify("echoIntegerArray", input, output);
+ } catch (Exception e) {
+ verify("echoIntegerArray", input, e);
+ }
+ }
+
+ {
+ Float input = new Float(3.7F);
+ try {
+ output = new Float(binding.echoFloat(input.floatValue()));
+ verify("echoFloat", input, output);
+ } catch (Exception e) {
+ verify("echoFloat", input, e);
+ }
+ }
+ {
+ float[] input = new float[] {3.7F, 7F};
+ try {
+ output = binding.echoFloatArray(input);
+ verify("echoFloatArray", input, output);
+ } catch (Exception e) {
+ verify("echoFloatArray", input, e);
+ }
+ }
+
+ {
+ SOAPStruct input = new SOAPStruct(5, "Hello", 103F);
+ try {
+ output = binding.echoStruct(input);
+ verify("echoStruct", input, output);
+ } catch (Exception e) {
+ verify("echoStruct", input, e);
+ }
+ }
+
+ {
+ SOAPStruct[] input = new SOAPStruct[] {
+ new SOAPStruct(1, "one", 1.1F),
+ new SOAPStruct(2, "two", 2.2F),
+ new SOAPStruct(3, "three", 3.3F)};
+ try {
+ output = binding.echoStructArray(input);
+ verify("echoStructArray", input, output);
+ } catch (Exception e) {
+ verify("echoStructArray", input, e);
+ }
+ }
+
+ {
+ try {
+ binding.echoVoid();
+ } catch (Exception e) {
+ verify("echoInteger", null, e);
+ }
+ }
+
+ {
+ byte[] input = "Base64".getBytes();
+ try {
+ output = binding.echoBase64(input);
+ verify("echoBase64", input, output);
+ } catch (Exception e) {
+ verify("echoBase64", input, e);
+ }
+ }
+
+ {
+ Hex input = new Hex("3344");
+ try {
+ output = binding.echoHexBinary(input.getBytes());
+ verify("echoHexBinary", input, output);
+ } catch (Exception e) {
+ verify("echoHexBinary", input, e);
+ }
+ }
+
+ {
+ Date input = new Date();
+ try {
+ output = binding.echoDate(input);
+ verify("echoDate", input, output);
+ } catch (Exception e) {
+ verify("echoDate", input, e);
+ }
+ }
+
+ {
+ BigDecimal input = new BigDecimal("3.14159");
+ try {
+ output = binding.echoDecimal(input);
+ verify("echoDecimal", input, output);
+ } catch (Exception e) {
+ verify("echoDecimal", input, e);
+ }
+ }
+
+ {
+ Boolean input = Boolean.TRUE;
+ try {
+ output = new Boolean( binding.echoBoolean(input.booleanValue()));
+ verify("echoBoolean", input, output);
+ } catch (Exception e) {
+ verify("echoBoolean", input, e);
+ }
+ }
+
HashMap map = new HashMap();
map.put(new Integer(5), "String Value");
map.put("String Key", new Date());
- test("Map ", map);
+ {
+ HashMap input = map;
+ try {
+ output = binding.echoMap(input);
+ verify("echoMap", input, output);
+ } catch (Exception e) {
+ verify("echoMap", input, e);
+ }
+ }
HashMap map2 = new HashMap();
map2.put("this is the second map", new Boolean(true));
map2.put("test", new Float(411));
- test("MapArray ", new HashMap [] { map, map2 });
+ {
+ HashMap[] input = new HashMap [] {map, map2 };
+ try {
+ output = binding.echoMapArray(input);
+ verify("echoMapArray", input, output);
+ } catch (Exception e) {
+ verify("echoMapArray", input, e);
+ }
+ }
+
+ {
+ SOAPStruct input = new SOAPStruct(5, "Hello", 103F);
+ try {
+ StringHolder outputString = new StringHolder();
+ IntHolder outputInteger = new IntHolder();
+ FloatHolder outputFloat = new FloatHolder();
+ binding.echoStructAsSimpleTypes(input, outputString, outputInteger,
outputFloat);
+ output = new SOAPStruct(outputInteger.value,
+ outputString.value,
+ outputFloat.value);
+ verify("echoStructAsSimpleTypes",
+ input, output);
+ } catch (Exception e) {
+ verify("echoStructAsSimpleTypes", input, e);
+ }
+ }
+
+ {
+ SOAPStruct input = new SOAPStruct(5, "Hello", 103F);
+ try {
+ output = binding.echoSimpleTypesAsStruct(
+ input.getVarString(), input.getVarInt(), input.getVarFloat());
+ verify("echoSimpleTypesAsStruct",
+ input,
+ output);
+ } catch (Exception e) {
+ verify("echoSimpleTypesAsStruct", input, e);
+ }
+ }
+
+ {
+ String[][] input = new String[2][2];
+ input[0][0] = "00";
+ input[0][1] = "01";
+ input[1][0] = "10";
+ input[1][1] = "11";
+ try {
+ output = binding.echo2DStringArray(input);
+ verify("echo2DStringArray",
+ input,
+ output);
+ } catch (Exception e) {
+ verify("echo2DStringArray", input, e);
+ }
+ }
+
+ {
+ SOAPStructStruct input = new SOAPStructStruct("AXIS",
+ 1,
+ 3F,
+ new SOAPStruct(5,
"Hello", 103F));
+ try {
+ output = binding.echoNestedStruct(input);
+ verify("echoNestedStruct", input, output);
+ } catch (Exception e) {
+ verify("echoNestedStruct", input, e);
+ }
+ }
+ {
+ SOAPArrayStruct input = new SOAPArrayStruct("AXIS",
+ 1,
+ 3F,
+ new String[] {"one", "two",
"three"});
+ try {
+ output = binding.echoNestedArray(input);
+ verify("echoNestedArray", input, output);
+ } catch (Exception e) {
+ verify("echoNestedArray", input, e);
+ }
+ }
}
/**
1.16 +66 -26 xml-axis/java/samples/echo/deploy.wsdd
Index: deploy.wsdd
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/deploy.wsdd,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- deploy.wsdd 12 Feb 2002 17:18:28 -0000 1.15
+++ deploy.wsdd 15 Feb 2002 19:41:16 -0000 1.16
@@ -13,32 +13,72 @@
<namespace>http://soapinterop.org/</namespace>
<parameter name="className" value="samples.echo.EchoService" />
<parameter name="allowedMethods" value="*" />
- <beanMapping xmlns:echo="http://soapinterop.org/xsd"
qname="echo:SOAPStructStruct"
- languageSpecificType="java:samples.echo.SOAPStructStruct"/>
- <beanMapping xmlns:echo="http://soapinterop.org/xsd"
qname="echo:SOAPArrayStruct"
- languageSpecificType="java:samples.echo.SOAPArrayStruct"/>
- <beanMapping xmlns:echo="http://soapinterop.org/xsd" qname="echo:SOAPStruct"
- languageSpecificType="java:samples.echo.SOAPStruct"/>
- <typeMapping xmlns:echo="http://soapinterop.org/xsd"
- qname="echo:ArrayOfSOAPStruct"
- type="java:samples.echo.SOAPStruct[]"
- serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
- deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" />
- <typeMapping xmlns:echo="http://soapinterop.org/xsd"
- qname="echo:ArrayOfstring"
- type="java:java.lang.String[]"
- serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
- deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" />
- <typeMapping xmlns:echo="http://soapinterop.org/xsd"
- qname="echo:ArrayOfint"
- type="java:int[]"
- serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
- deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" />
- <typeMapping xmlns:echo="http://soapinterop.org/xsd"
- qname="echo:ArrayOffloat"
- type="java:float[]"
- serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
- deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" />
+
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:ArrayOfstring"
+ type="java:java.lang.String[]"
+ serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:ArrayOfString2D"
+ type="java:java.lang.String[][]"
+ serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:ArrayOfint"
+ type="java:int[]"
+ serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:ArrayOffloat"
+ type="java:float[]"
+ serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:SOAPStruct"
+ type="java:samples.echo.SOAPStruct"
+ serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:ArrayOfSOAPStruct"
+ type="java:samples.echo.SOAPStruct[]"
+ serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:SOAPStructStruct"
+ type="java:samples.echo.SOAPStructStruct"
+ serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+ <typeMapping
+ xmlns:ns="http://soapinterop.org/xsd"
+ qname="ns:SOAPArrayStruct"
+ type="java:samples.echo.SOAPArrayStruct"
+ serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+ deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ />
+
<requestFlow>
<handler type="java:samples.echo.echoHeaderStringHandler"/>
<handler type="java:samples.echo.echoHeaderStructHandler"/>
1.10 +18 -37 xml-axis/java/src/javax/xml/rpc/namespace/QName.java
Index: QName.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/namespace/QName.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- QName.java 11 Jan 2002 21:01:48 -0000 1.9
+++ QName.java 15 Feb 2002 19:41:17 -0000 1.10
@@ -61,18 +61,22 @@
import org.w3c.dom.Node;
/**
- * QName class represents a qualified name based on "Namespaces in XML"
specification. A QName is represented as:
+ * QName class represents a qualified name based on "Namespaces in XML"
specification.
+ * A QName is represented as:
* QName ::= (Prefix ':') ? LocalPart
*
+ * Upgraded the implementation so that the namespaceURI and localPart are
+ * always non-null. This simplifies the implementation, increases performance,
+ * and cleans up NullPointerException problems.
* @version 0.1
*/
public class QName {
/** Field namespaceURI */
- private String namespaceURI = null;
+ private String namespaceURI = "";
/** Field localPart */
- private String localPart = null;
+ private String localPart = "";
/**
* Constructor for the QName.
@@ -126,6 +130,8 @@
* @param localPart
*/
public void setLocalPart(String localPart) {
+ if (localPart == null)
+ localPart = "";
this.localPart = localPart;
}
@@ -145,7 +151,7 @@
*/
public String toString() {
- if (namespaceURI == null || namespaceURI.equals("")) {
+ if (namespaceURI.equals("")) {
return localPart;
} else {
return namespaceURI + ":" + localPart;
@@ -160,31 +166,19 @@
* @return true if this object is the same as the obj argument; false otherwise.
*/
public boolean equals(Object p1) {
+ if (p1 == this) {
+ return true;
+ }
if (!(p1 instanceof QName)) {
return false;
}
- if (namespaceURI == null) {
- if (((QName) p1).namespaceURI != null) {
- return false;
- }
- } else {
- if (!namespaceURI.equals(((QName) p1).namespaceURI)) {
- return false;
- }
- }
-
- if (localPart == null) {
- if (((QName) p1).localPart != null) {
- return false;
- }
- else {
- return true;
- }
+ if (namespaceURI.equals(((QName)p1).namespaceURI) &&
+ localPart.equals(((QName)p1).localPart)) {
+ return true;
}
-
- return localPart.equals(((QName) p1).localPart);
+ return false;
}
/**
@@ -193,20 +187,7 @@
* @return a hash code value for this Qname object
*/
public int hashCode() {
- if (namespaceURI == null) {
- if (localPart == null) {
- return 0;
- }
- else {
- return localPart.hashCode();
- }
- }
- else if (localPart == null) {
- return namespaceURI.hashCode();
- }
- else {
- return namespaceURI.hashCode() ^ localPart.hashCode();
- }
+ return namespaceURI.hashCode() ^ localPart.hashCode();
}
// temporary!!
1.10 +6 -5
xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java
Index: ArraySerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ArraySerializer.java 6 Feb 2002 19:00:20 -0000 1.9
+++ ArraySerializer.java 15 Feb 2002 19:41:17 -0000 1.10
@@ -177,13 +177,14 @@
// way to determine whether the arrays are multi-referenced.
// Thus the code is currently disabled (see enable2Dim below).
//
- // In the future this code may be enabled for cases that we know
- // are safe.
- // (More complicated processing is necessary for 3-dim arrays, etc.
- // This initial support is mainly used to test deserialization.)
+ // Currently the support is ENABLED because it is necessary for
+ // interoperability (echo2DStringArray). It is 'safe' for now
+ // because Axis treats arrays as non multi-ref (see the note
+ // in SerializationContextImpl.isPrimitive(...) )
+ // More complicated processing is necessary for 3-dim arrays, etc.
//
int dim2Len = -1;
- boolean enable2Dim = false; // Disabled
+ boolean enable2Dim = true; // Disabled
if (enable2Dim && !dims.equals("")) {
if (cls.isArray() && len > 0) {
boolean okay = true;
1.31 +1 -1
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- JavaStubWriter.java 14 Feb 2002 14:59:31 -0000 1.30
+++ JavaStubWriter.java 15 Feb 2002 19:41:17 -0000 1.31
@@ -522,7 +522,7 @@
if (p.mode == Parameter.IN) {
pw.print(wrapPrimitiveType(p.type, javifiedName));
}
- else { // p.mode == Parameter.INOUT
+ else {
pw.print(wrapPrimitiveType(p.type, javifiedName + ".value"));
}
}
1.6 +6 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java
Index: JavaWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JavaWriter.java 31 Jan 2002 17:28:52 -0000 1.5
+++ JavaWriter.java 15 Feb 2002 19:41:17 -0000 1.6
@@ -253,8 +253,12 @@
String objType = type == null ? null : (String) TYPES.get(type.getName());
if (objType != null) {
return "new " + objType + "(" + var + ")";
- }
- else {
+ } else if (type != null &&
+ type.getName().equals("byte[]") &&
+ type.getQName().getLocalPart().equals("hexBinary")) {
+ // Need to wrap byte[] in special Hex object to get the correct
serialization
+ return "new org.apache.axis.encoding.Hex(" + var + ")";
+ } else {
return var;
}
} // wrapPrimitiveType
1.8 +46 -120 xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SchemaUtils.java 5 Feb 2002 22:42:35 -0000 1.7
+++ SchemaUtils.java 15 Feb 2002 19:41:17 -0000 1.8
@@ -62,6 +62,7 @@
import javax.wsdl.Fault;
import javax.wsdl.Message;
import javax.xml.rpc.holders.BooleanHolder;
+import javax.xml.rpc.holders.IntHolder;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.Collator;
@@ -504,13 +505,16 @@
/**
* If the specified node represents an array encoding of one of the following
* forms, then return the qname repesenting the element type of the array.
+ * @param node is the node
+ * @param dims is the output value that contains the number of dimensions if
return is not null
+ * @return QName or null
*/
- public static QName getArrayElementQName(Node node) {
+ public static QName getArrayElementQName(Node node, IntHolder dims) {
+ dims.value = 1; // assume 1 dimension
QName qName = getCollectionElementQName(node);
- if (qName == null)
- qName = getArrayElementQName_JAXRPC(node);
- // if (qName == null)
- // qName = getArrayElementQName_nonJAXRPC(node);
+ if (qName == null) {
+ qName = getArrayElementQName_JAXRPC(node, dims);
+ }
return qName;
}
@@ -550,6 +554,10 @@
* If the specified node represents an array encoding of one of the following
* forms, then return the qname repesenting the element type of the array.
*
+ * @param node is the node
+ * @param dims is the output value that contains the number of dimensions if
return is not null
+ * @return QName or null
+ *
* JAX-RPC Style 2:
*<xsd:complexType name="hobbyArray">
* <xsd:complexContent>
@@ -571,7 +579,8 @@
*</xsd:complexType>
*
*/
- private static QName getArrayElementQName_JAXRPC(Node node) {
+ private static QName getArrayElementQName_JAXRPC(Node node, IntHolder dims) {
+ dims.value = 0; // Assume 0
if (node == null) {
return null;
}
@@ -657,41 +666,47 @@
if (kind != null &&
kind.getLocalPart().equals("attribute") &&
Constants.isSchemaXSD(kind.getNamespaceURI())) {
- attributeNode = children.item(j);
+ // If the attribute node does not have
ref="soapenc:arrayType"
+ // then keep looking.
+ QName refQName =
Utils.getNodeTypeRefQName(children.item(j), "ref");
+ if (refQName != null &&
+ refQName.getLocalPart().equals("arrayType") &&
+ Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
+ attributeNode = children.item(j);
+ }
}
}
}
- // If there is an attribute node, it must have a ref of soapenc:array
and
- // a wsdl:arrayType attribute.
+ // If there is an attribute node, look at wsdl:arrayType to get the
element type
if (attributeNode != null) {
- QName refQName = Utils.getNodeTypeRefQName(attributeNode, "ref");
- if (refQName != null &&
- refQName.getLocalPart().equals("arrayType") &&
- Constants.isSOAP_ENC(refQName.getNamespaceURI()))
- ; // Okay
- else
- refQName = null; // Did not find ref="soapenc:arrayType"
-
String wsdlArrayTypeValue = null;
- if (refQName != null) {
- Vector attrs = Utils.getAttributesWithLocalName(attributeNode,
"arrayType");
- for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null;
i++) {
- Node attrNode = (Node) attrs.elementAt(i);
- String attrName = attrNode.getNodeName();
- QName attrQName =
Utils.getQNameFromPrefixedName(attributeNode, attrName);
- if (Constants.isWSDL(attrQName.getNamespaceURI())) {
- wsdlArrayTypeValue = attrNode.getNodeValue();
- }
+ Vector attrs = Utils.getAttributesWithLocalName(attributeNode,
"arrayType");
+ for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
+ Node attrNode = (Node) attrs.elementAt(i);
+ String attrName = attrNode.getNodeName();
+ QName attrQName = Utils.getQNameFromPrefixedName(attributeNode,
attrName);
+ if (Constants.isWSDL(attrQName.getNamespaceURI())) {
+ wsdlArrayTypeValue = attrNode.getNodeValue();
}
}
-
- // The value should have [] on the end, strip these off.
- // The convert the prefixed name into a qname, and return
+
+ // The value could have any number of [] or [,] on the end
+ // Strip these off to get the prefixed name.
+ // The convert the prefixed name into a qname.
+ // Count the number of [ and , to get the dim information.
if (wsdlArrayTypeValue != null) {
- int i = wsdlArrayTypeValue.indexOf("[");
+ int i = wsdlArrayTypeValue.indexOf('[');
if (i > 0) {
String prefixedName = wsdlArrayTypeValue.substring(0,i);
+ String mangledString = wsdlArrayTypeValue.replace(',', '[');
+ dims.value = 0;
+ int index = mangledString.indexOf('[');
+ while (index > 0) {
+ dims.value++;
+ index = mangledString.indexOf('[',index+1);
+ }
+
return Utils.getQNameFromPrefixedName(restrictionNode,
prefixedName);
}
}
@@ -716,6 +731,7 @@
if (maxOccursValue != null &&
maxOccursValue.equalsIgnoreCase("unbounded")) {
// Get the QName of just the type
+ dims.value = 1;
return Utils.getNodeTypeRefQName(elementNode, "type");
}
}
@@ -725,95 +741,5 @@
return null;
}
- /**
- * If the specified node represents an array encoding of one of the following
- * forms, then return the qname repesenting the element type of the array.
- *
- * Microsoft Encoding #1:
- *<xsd:complexType name="billArray">
- * <xsd:sequence>
- * <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
- * </xsd:sequence>
- *</xsd:complexType>
- *
- * Microsoft Encoding #2:
- *<xsd:complexType name="gatesArray">
- * <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
- *</xsd:complexType>
- *
- */
- private static QName getArrayElementQName_nonJAXRPC(Node node) {
- if (node == null) {
- return null;
- }
-
- // If the node kind is an element, dive into it.
- QName nodeKind = Utils.getNodeQName(node);
- if (nodeKind != null &&
- nodeKind.getLocalPart().equals("element") &&
- Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
- NodeList children = node.getChildNodes();
- Node complexNode = null;
- for (int j = 0; j < children.getLength() && complexNode == null; j++) {
- QName complexKind = Utils.getNodeQName(children.item(j));
- if (complexKind != null &&
- complexKind.getLocalPart().equals("complexType") &&
- Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
- complexNode = children.item(j);
- node = complexNode;
- }
- }
- }
- // Get the node kind, expecting a schema complexType
- nodeKind = Utils.getNodeQName(node);
- if (nodeKind != null &&
- nodeKind.getLocalPart().equals("complexType") &&
- Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
-
- // Inder the complexType there could be a group node.
- // (There may be other #text nodes, which we will ignore).
- NodeList children = node.getChildNodes();
- Node groupNode = null;
- for (int j = 0;
- j < children.getLength() && groupNode == null;
- j++) {
- QName kind = Utils.getNodeQName(children.item(j));
- if (kind != null &&
- (kind.getLocalPart().equals("sequence") ||
- kind.getLocalPart().equals("all")) &&
- Constants.isSchemaXSD(kind.getNamespaceURI())) {
- groupNode = children.item(j);
- }
- }
-
- // If a group node, a single element should be underneath
- if (groupNode != null) {
- children = groupNode.getChildNodes();
- }
-
- // Now get the element node. There can only be one element node.
- Node elementNode = null;
- int elementNodeCount = 0;
- for (int i=0; i < children.getLength(); i++) {
- QName elementKind = Utils.getNodeQName(children.item(i));
- if (elementKind != null &&
- elementKind.getLocalPart().equals("element") &&
- Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
- elementNode = children.item(i);
- elementNodeCount++;
- }
- }
-
- // The single element node should have maxOccurs="unbounded" and a type
- if (elementNodeCount == 1) {
- String maxOccursValue = Utils.getAttribute(elementNode,
"maxOccurs");
- if (maxOccursValue != null &&
- maxOccursValue.equalsIgnoreCase("unbounded")) {
- return Utils.getNodeTypeRefQName(elementNode, "type");
- }
- }
- }
- return null;
- }
}
1.5 +9 -6 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java
Index: SymTabEntry.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SymTabEntry.java 14 Dec 2001 20:01:16 -0000 1.4
+++ SymTabEntry.java 15 Feb 2002 19:41:17 -0000 1.5
@@ -90,7 +90,7 @@
/**
* Get the QName of this entry.
*/
- public QName getQName() {
+ public final QName getQName() {
return qname;
} // getQName
@@ -113,21 +113,24 @@
/**
* Is this entry referenced by any other entry in the symbol table?
*/
- public boolean isReferenced() {
+ public final boolean isReferenced() {
return isReferenced;
} // isReferenced
/**
* Set the isReferenced variable, default value is true.
*/
- public void setIsReferenced(boolean isReferenced) {
+ public final void setIsReferenced(boolean isReferenced) {
this.isReferenced = isReferenced;
} // setIsReferenced
/**
- * There may be information that does not exist in WSDL4J/DOM structures and
does not exist in
- * our additional structures, but that thw Writer implementation will need.
This information is
- * most likely context-relative, so the DynamicVar map is provided for the
Writers to store/
+ * There may be information that does not exist in WSDL4J/DOM
+ * structures and does not exist in
+ * our additional structures, but that Writer implementation
+ * will need. This information is
+ * most likely context-relative, so the DynamicVar map is
+ * provided for the Writers to store and
* retrieve their particular information.
*/
public Object getDynamicVar(Object key) {
1.32 +8 -3 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- SymbolTable.java 14 Feb 2002 14:59:31 -0000 1.31
+++ SymbolTable.java 15 Feb 2002 19:41:17 -0000 1.32
@@ -91,6 +91,7 @@
import javax.wsdl.extensions.soap.SOAPBody;
import javax.xml.rpc.holders.BooleanHolder;
+import javax.xml.rpc.holders.IntHolder;
import org.apache.axis.Constants;
@@ -607,7 +608,9 @@
// Flow to here indicates no type= or ref= attribute.
// See if this is an array or simple type definition.
- QName arrayEQName = SchemaUtils.getArrayElementQName(node);
+ IntHolder numDims = new IntHolder();
+ numDims.value = 0;
+ QName arrayEQName = SchemaUtils.getArrayElementQName(node, numDims);
QName simpleQName = SchemaUtils.getSimpleTypeBase(node, this);
if (arrayEQName != null || simpleQName != null) {
@@ -626,9 +629,11 @@
// Create a defined type or element that references refType
String dims = "";
- if (arrayEQName != null) {
- dims = "[]";
+ while (numDims.value > 0) {
+ dims += "[]";
+ numDims.value--;
}
+
TypeEntry defType = null;
if (isElement) {
if (!belowSchemaLevel) {
1.15 +2 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Utils.java 14 Feb 2002 15:41:14 -0000 1.14
+++ Utils.java 15 Feb 2002 19:41:17 -0000 1.15
@@ -62,6 +62,7 @@
import javax.wsdl.Fault;
import javax.wsdl.Message;
import javax.xml.rpc.holders.BooleanHolder;
+import javax.xml.rpc.holders.IntHolder;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
@@ -699,7 +700,7 @@
}
// Process array element types
- QName elementQName = SchemaUtils.getArrayElementQName(type);
+ QName elementQName = SchemaUtils.getArrayElementQName(type, new
IntHolder(0));
TypeEntry elementType = symbolTable.getType(elementQName);
if (elementType != null) {
if (!types.contains(elementType)) {
1.11 +3 -2 xml-axis/java/test/utils/TestQName.java
Index: TestQName.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/TestQName.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TestQName.java 11 Jan 2002 21:42:11 -0000 1.10
+++ TestQName.java 15 Feb 2002 19:41:17 -0000 1.11
@@ -27,8 +27,9 @@
public void testQNameDefaultConstructor()
{
QName qname = new QName();
- assertTrue("qname not an instance of QName", qname instanceof QName); // ??
not really necessary. Compiler won't compile otherwise
- assertNull("LocalPart was not null", qname.getLocalPart());
+ assertTrue("qname not an instance of QName", qname instanceof QName);
+ // ?? not really necessary. Compiler won't compile otherwise
+ // assertNull("LocalPart was not null", qname.getLocalPart());
}
public void testQName2StringConstructor()
1.70 +2 -1 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
Index: Wsdl2javaTestSuite.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- Wsdl2javaTestSuite.xml 12 Feb 2002 22:10:19 -0000 1.69
+++ Wsdl2javaTestSuite.xml 15 Feb 2002 19:41:17 -0000 1.70
@@ -515,6 +515,7 @@
file is only for reference.
-->
<!-- <wsdl2java url="test/wsdl/literal/SalesRankNPrice.wsdl" -->
+ <!-- Site is offline
<wsdl2java
url="http://www.perfectxml.net/WebServices/SalesRankNPrice/BookService.asmx?WSDL"
output="build/work"
verbose="no"
@@ -523,7 +524,7 @@
<mapping namespace="http://www.PerfectXML.com/NETWebSvcs/BookService"
package="test.wsdl.literal"/>
</wsdl2java>
-
+ -->
<!-- The following WSDL are BAD. We're keeping them here so we can -->
<!-- check periodically to see whether the owner has fixed them. -->