gdaniels 2003/01/02 11:26:14 Modified: java/src/org/apache/axis/client Call.java java/test/wsdl/interop4/groupG/dime/doc DimeDOCInteropTestCase.java java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java java/test/wsdl/interop4/groupG/mime/doc MimeDOCInteropTestCase.java Log: Fix document style attachments tests for interop4 group "G". Two major changes (plus a little cleanup in Call): 1) Call now uses the OperationDesc's returnClass, and doesn't keep a separate (and potentially out-of-sync) copy in its own field. 2) JavaStubWriter now uses the more-correct classes for attachment parameters, so that the addParameter()/setReturnClass() calls match what we expect. This allows array conversions to work correctly. Uncommented the group G doc style tests. Revision Changes Path 1.197 +6 -12 xml-axis/java/src/org/apache/axis/client/Call.java Index: Call.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v retrieving revision 1.196 retrieving revision 1.197 diff -u -r1.196 -r1.197 --- Call.java 30 Dec 2002 14:36:45 -0000 1.196 +++ Call.java 2 Jan 2003 19:26:13 -0000 1.197 @@ -199,9 +199,6 @@ // A place to store any client-specified headers private Vector myHeaders = null; - // The desired return Java type, so we can do conversions if needed - private Class returnJavaType = null; - public static final String SEND_TYPE_ATTR = "send_type_attr" ; public static final String TRANSPORT_NAME = "transport_name" ; public static final String TRANSPORT_PROPERTY= "java.protocol.handler.pkgs"; @@ -1015,7 +1012,6 @@ */ public void setReturnType(QName xmlType, Class javaType) { setReturnType(xmlType); - returnJavaType = javaType; // Use specified type as the operation return operation.setReturnClass(javaType); } @@ -1096,8 +1092,6 @@ TypeMapping tm = getTypeMapping(); operation.setReturnType(tm.getTypeQName(cls)); parmAndRetReq = true; - - returnJavaType = cls; } /** @@ -1157,7 +1151,6 @@ * * Note: Not part of JAX-RPC specification. * - * @param portName PortName in the WSDL doc to search for * @param opName Operation(method) that's going to be invoked */ public void setOperation(String opName) { @@ -1423,7 +1416,6 @@ // Get the SOAPAction //////////////////////////////////////////////////////////////////// - String opStyle = null; BindingOperation bop = binding.getBindingOperation(opName, null, null); if ( bop == null ) @@ -1434,7 +1426,6 @@ Object obj = list.get(i); if ( obj instanceof SOAPOperation ) { SOAPOperation sop = (SOAPOperation) obj ; - opStyle = ((SOAPOperation) obj).getStyle(); String action = sop.getSoapActionURI(); if ( action != null ) { setUseSOAPAction(true); @@ -2306,8 +2297,8 @@ } // Convert type if needed - if (returnJavaType != null) { - result = JavaUtils.convert(result, returnJavaType); + if (operation != null && operation.getReturnClass() != null) { + result = JavaUtils.convert(result, operation.getReturnClass()); } return( result ); @@ -2492,7 +2483,10 @@ SOAPBodyElement respBody = resEnv.getFirstBody(); if (respBody instanceof SOAPFault) { - if(returnJavaType == null || returnJavaType != javax.xml.soap.SOAPMessage.class) + if(operation == null || + operation.getReturnClass() == null || + operation.getReturnClass() != + javax.xml.soap.SOAPMessage.class) throw ((SOAPFault)respBody).getFault(); } } 1.2 +0 -4 xml-axis/java/test/wsdl/interop4/groupG/dime/doc/DimeDOCInteropTestCase.java Index: DimeDOCInteropTestCase.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/doc/DimeDOCInteropTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DimeDOCInteropTestCase.java 2 Jan 2003 00:02:42 -0000 1.1 +++ DimeDOCInteropTestCase.java 2 Jan 2003 19:26:13 -0000 1.2 @@ -58,16 +58,12 @@ input[0] = new OctetStream("EchoAttachments0".getBytes()); input[1] = new OctetStream("EchoAttachments1".getBytes()); - //TODO: Need to fix wsdl2java generation. Getting a "Bad Types" - // Exception if we enable the following code. - /* // Test operation OctetStream[] output = null; output = binding.echoAttachments(input); // TBD - validate results assertTrue(Arrays.equals(input[0].getBytes(), output[0].getBytes())); assertTrue(Arrays.equals(input[1].getBytes(), output[1].getBytes())); - */ } public void test3DimeDOCSoapPortEchoAttachmentAsBase64() throws Exception { 1.109 +3 -2 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.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- JavaStubWriter.java 30 Dec 2002 14:36:46 -0000 1.108 +++ JavaStubWriter.java 2 Jan 2003 19:26:13 -0000 1.109 @@ -57,6 +57,7 @@ import org.apache.axis.enum.Style; import org.apache.axis.enum.Use; import org.apache.axis.utils.Messages; +import org.apache.axis.utils.JavaUtils; import org.apache.axis.wsdl.symbolTable.BindingEntry; import org.apache.axis.wsdl.symbolTable.CollectionTE; import org.apache.axis.wsdl.symbolTable.Element; @@ -376,7 +377,7 @@ String javaType = null; if (p.getMIMEInfo() != null) { MimeInfo mimeInfo = p.getMIMEInfo(); - javaType = "javax.activation.DataHandler" + mimeInfo.getDimensions() + ".class, "; + javaType = JavaUtils.mimeToJava(mimeInfo.getType()) + mimeInfo.getDimensions() + ".class, "; } else { javaType = p.getType().getName(); @@ -410,7 +411,7 @@ String javaType = null; if (parameters.returnParam.getMIMEInfo() != null) { MimeInfo mimeInfo = parameters.returnParam.getMIMEInfo(); - javaType = "javax.activation.DataHandler" + mimeInfo.getDimensions(); + javaType = JavaUtils.mimeToJava(mimeInfo.getType()) + mimeInfo.getDimensions(); } else { javaType = parameters.returnParam.getType().getName(); 1.2 +0 -4 xml-axis/java/test/wsdl/interop4/groupG/mime/doc/MimeDOCInteropTestCase.java Index: MimeDOCInteropTestCase.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/doc/MimeDOCInteropTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MimeDOCInteropTestCase.java 31 Dec 2002 22:46:51 -0000 1.1 +++ MimeDOCInteropTestCase.java 2 Jan 2003 19:26:14 -0000 1.2 @@ -60,16 +60,12 @@ input[0] = new OctetStream("EchoAttachments0".getBytes()); input[1] = new OctetStream("EchoAttachments1".getBytes()); - //TODO: Need to fix wsdl2java generation. Getting a "Bad Types" - // Exception if we enable the following code. - /* // Test operation OctetStream[] output = null; output = binding.echoAttachments(input); // TBD - validate results assertTrue(Arrays.equals(input[0].getBytes(), output[0].getBytes())); assertTrue(Arrays.equals(input[1].getBytes(), output[1].getBytes())); - */ } public void test3MimeDOCSoapPortEchoAttachmentAsBase64() throws Exception {