dims 2002/12/31 14:46:52 Modified: java/test/wsdl/interop4/groupG/mime/doc build.xml mime-doc.wsdl java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java SymbolTable.java Added: java/test/wsdl/interop4/groupG/mime/doc AttachmentsBindingImpl.java MimeDOCInteropTestCase.java Log: Initial check-in for GroupG Interop mime/doc tests. Note: - EchoAttachments does not work. (Glen, Can you please help?) Revision Changes Path 1.3 +8 -7 xml-axis/java/test/wsdl/interop4/groupG/mime/doc/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/doc/build.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- build.xml 29 Nov 2002 23:32:53 -0000 1.2 +++ build.xml 31 Dec 2002 22:46:51 -0000 1.3 @@ -54,7 +54,8 @@ <!-- generate skeletons --> <wsdl2java url="${axis.home}/test/wsdl/interop4/groupG/mime/doc/mime-doc.wsdl" output="${root.dir}/build/work" - skeletonDeploy="no" + timeout="-1" + skeletonDeploy="yes" testCase="yes" serverSide="yes"> <mapping namespace="http://soapinterop.org/attachments/wsdl" package="test.wsdl.interop4.groupG.mime.doc"/> @@ -70,14 +71,14 @@ </wsdl2java> <mkdir dir="${build.dest}"/> - <!-- - <copy file="BaseTypesInteropTestsTestCase.java" - todir="${root.dir}/build/work/test/wsdl/interop5/basetype/" + + <copy file="${axis.home}/test/wsdl/interop4/groupG/mime/doc/MimeDOCInteropTestCase.java" + todir="${root.dir}/build/work/test/wsdl/interop4/groupG/mime/doc" overwrite="yes"/> - <copy file="InteropTestsBindingImpl.java" - todir="${root.dir}/build/work/test/wsdl/interop5/basetype/" + <copy file="${axis.home}/test/wsdl/interop4/groupG/mime/doc/AttachmentsBindingImpl.java" + todir="${root.dir}/build/work/test/wsdl/interop4/groupG/mime/doc" overwrite="yes"/> - --> + <!-- compile the skeletons --> <javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="on"> 1.2 +5 -0 xml-axis/java/test/wsdl/interop4/groupG/mime/doc/mime-doc.wsdl Index: mime-doc.wsdl =================================================================== RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/doc/mime-doc.wsdl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- mime-doc.wsdl 1 Nov 2002 21:43:04 -0000 1.1 +++ mime-doc.wsdl 31 Dec 2002 22:46:51 -0000 1.2 @@ -177,4 +177,9 @@ </wsdl:output> </wsdl:operation> </wsdl:binding> + <wsdl:service name="MimeDOCInterop"> + <wsdl:port name="MimeDOCSoapPort" binding="AttachmentsBinding"> + <soap:address location="http://localhost:8080/axis/services/MimeDOCSoapPort"/> + </wsdl:port> + </wsdl:service> </wsdl:definitions> 1.1 xml-axis/java/test/wsdl/interop4/groupG/mime/doc/AttachmentsBindingImpl.java Index: AttachmentsBindingImpl.java =================================================================== /** * AttachmentsBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.interop4.groupG.mime.doc; public class AttachmentsBindingImpl implements test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType{ public org.apache.axis.attachments.OctetStream echoAttachment(org.apache.axis.attachments.OctetStream in) throws java.rmi.RemoteException { return in; } public org.apache.axis.attachments.OctetStream[] echoAttachments(org.apache.axis.attachments.OctetStream item[]) throws java.rmi.RemoteException { return item; } public test.wsdl.interop4.groupG.mime.doc.xsd.Binary echoAttachmentAsBase64(org.apache.axis.attachments.OctetStream in) throws java.rmi.RemoteException { return new test.wsdl.interop4.groupG.mime.doc.xsd.Binary(in.getBytes()); } public org.apache.axis.attachments.OctetStream echoBase64AsAttachment(test.wsdl.interop4.groupG.mime.doc.xsd.Binary in) throws java.rmi.RemoteException { return new org.apache.axis.attachments.OctetStream(in.getValue()); } } 1.1 xml-axis/java/test/wsdl/interop4/groupG/mime/doc/MimeDOCInteropTestCase.java Index: MimeDOCInteropTestCase.java =================================================================== /** * MimeDOCInteropTestCase.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package test.wsdl.interop4.groupG.mime.doc; import org.apache.axis.attachments.OctetStream; import java.util.Arrays; import java.net.URL; public class MimeDOCInteropTestCase extends junit.framework.TestCase { public MimeDOCInteropTestCase(java.lang.String name) { super(name); } protected void setUp() throws Exception { if(url == null) { url = new URL(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress()); } } public void test1MimeDOCSoapPortEchoAttachment() throws Exception { test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding; try { binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); // Test operation OctetStream input = new OctetStream("EchoAttachment".getBytes()); OctetStream output = null; output = binding.echoAttachment(input); // TBD - validate results assertTrue(Arrays.equals(input.getBytes(), output.getBytes())); } public void test2MimeDOCSoapPortEchoAttachments() throws Exception { test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding; try { binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); OctetStream[] input = new OctetStream[2]; 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 { test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding; try { binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); OctetStream input = new OctetStream("EchoAttachmentAsBase64".getBytes()); // Test operation test.wsdl.interop4.groupG.mime.doc.xsd.Binary output = null; output = binding.echoAttachmentAsBase64(input); // TBD - validate results assertTrue(Arrays.equals(input.getBytes(), output.getValue())); } public void test4MimeDOCSoapPortEchoBase64AsAttachment() throws Exception { test.wsdl.interop4.groupG.mime.doc.AttachmentsPortType binding; try { binding = new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPort(url); } catch (javax.xml.rpc.ServiceException jre) { if(jre.getLinkedCause()!=null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertTrue("binding is null", binding != null); byte[] input = "EchoBase64AsAttachment".getBytes(); // Test operation OctetStream output = null; output = binding.echoBase64AsAttachment(new test.wsdl.interop4.groupG.mime.doc.xsd.Binary(input)); // TBD - validate results assertTrue(Arrays.equals(input, output.getBytes())); } public static URL url = null; public static void main(String[] args) throws Exception { if (args.length == 1) { url = new URL(args[0]); } else { url = new URL(new test.wsdl.interop4.groupG.mime.doc.MimeDOCInteropLocator().getMimeDOCSoapPortAddress()); } junit.textui.TestRunner.run(new junit.framework.TestSuite(MimeDOCInteropTestCase.class)); } // main } 1.21 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java Index: SchemaUtils.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- SchemaUtils.java 26 Dec 2002 23:24:29 -0000 1.20 +++ SchemaUtils.java 31 Dec 2002 22:46:51 -0000 1.21 @@ -732,7 +732,7 @@ * @param node is the Node * @return QName of the compoent of the collection */ - private static QName getCollectionComponentQName(Node node) { + public static QName getCollectionComponentQName(Node node) { if (node == null) { return null; } 1.65 +26 -1 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- SymbolTable.java 30 Dec 2002 14:36:45 -0000 1.64 +++ SymbolTable.java 31 Dec 2002 22:46:51 -0000 1.65 @@ -1832,7 +1832,13 @@ if (obj instanceof MIMEContent) { MIMEContent content = (MIMEContent) obj; TypeEntry typeEntry = findPart(op, content.getPart()); - bEntry.setMIMEInfo(op.getName(), content.getPart(), content.getType(), typeEntry.getDimensions()); + String dims = typeEntry.getDimensions(); + if(dims.length() <=0 && typeEntry.getRefType() != null) { + Node node = typeEntry.getRefType().getNode(); + if(getCollectionComponentQName(node)!=null) + dims += "[]"; + } + bEntry.setMIMEInfo(op.getName(), content.getPart(), content.getType(), dims); } else if (obj instanceof SOAPBody) { String use = ((SOAPBody) obj).getUse(); @@ -2305,4 +2311,23 @@ Messages.getMessage("alreadyExists00", "" + name)); } } // symbolTablePut + + private static QName getCollectionComponentQName(Node node) { + if (node == null) { + return null; + } + + QName name = SchemaUtils.getCollectionComponentQName(node); + if(name != null) + return name; + + // Dive into the node if necessary + NodeList children = node.getChildNodes(); + for(int i=0;i<children.getLength();i++){ + name = getCollectionComponentQName(children.item(i)); + if(name != null) + return name; + } + return null; + } } // class SymbolTable