dims        2002/12/30 06:36:46

  Modified:    java/test/wsdl/interop4/groupG/dime/rpc
                        AttachmentsBindingImpl.java build.xml
                        DimeRPCInteropTestCase.java
               java/test/wsdl/interop4/groupG/mime/rpc
                        AttachmentsBindingImpl.java build.xml
                        MimeRPCInteropTestCase.java
               java/src/org/apache/axis/wsdl/symbolTable BindingEntry.java
                        Parameter.java SymbolTable.java
               java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/wsdl/toJava
                        JavaGeneratorFactory.java JavaStubWriter.java
                        JavaTestCaseWriter.java Utils.java
               java/src/org/apache/axis/encoding/ser
                        OctetStreamDataHandlerDeserializer.java
  Added:       java/src/org/apache/axis/wsdl/symbolTable MimeInfo.java
  Log:
  get dime/rpc and mime/rpc working (for Bug 13769 - Group G: SwA/DIME (attachments) 
WSDL Problems)
  
  Revision  Changes    Path
  1.3       +7 -1      
xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/AttachmentsBindingImpl.java
  
  Index: AttachmentsBindingImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/AttachmentsBindingImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttachmentsBindingImpl.java       28 Dec 2002 17:59:06 -0000      1.2
  +++ AttachmentsBindingImpl.java       30 Dec 2002 14:36:44 -0000      1.3
  @@ -7,12 +7,15 @@
   
   package test.wsdl.interop4.groupG.dime.rpc;
   
  +import org.apache.axis.AxisEngine;
  +import org.apache.axis.Message;
  +
   public class AttachmentsBindingImpl implements 
test.wsdl.interop4.groupG.dime.rpc.AttachmentsPortType{
       public org.apache.axis.attachments.OctetStream 
echoAttachment(org.apache.axis.attachments.OctetStream in) throws 
java.rmi.RemoteException {
           return in;
       }
   
  -    public test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary[] 
echoAttachments(test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary[] in) throws 
java.rmi.RemoteException {
  +    public org.apache.axis.attachments.OctetStream[] 
echoAttachments(org.apache.axis.attachments.OctetStream in[]) throws 
java.rmi.RemoteException {
           return in;
       }
   
  @@ -21,10 +24,13 @@
       }
   
       public org.apache.axis.attachments.OctetStream echoBase64AsAttachment(byte[] 
in) throws java.rmi.RemoteException {
  +        Message response = 
AxisEngine.getCurrentMessageContext().getResponseMessage();
  +        
response.getAttachmentsImpl().setSendType(org.apache.axis.attachments.Attachments.SEND_TYPE_DIME);
           return new org.apache.axis.attachments.OctetStream(in);
       }
   
       public void echoUnrefAttachments() throws java.rmi.RemoteException {
  +        //TODO: What do we do here?
       }
   
       public java.lang.String echoAttachmentAsString(java.lang.String in) throws 
java.rmi.RemoteException {
  
  
  
  1.5       +2 -2      xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/build.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- build.xml 28 Dec 2002 17:59:06 -0000      1.4
  +++ build.xml 30 Dec 2002 14:36:44 -0000      1.5
  @@ -71,14 +71,14 @@
       </wsdl2java>
   
       <mkdir dir="${build.dest}"/>
  -    <!--
  +
       <copy 
file="${axis.home}/test/wsdl/interop4/groupG/dime/rpc/DimeRPCInteropTestCase.java"
             todir="${root.dir}/build/work/test/wsdl/interop4/groupG/dime/rpc"
             overwrite="yes"/>
       <copy 
file="${axis.home}/test/wsdl/interop4/groupG/dime/rpc/AttachmentsBindingImpl.java"
             todir="${root.dir}/build/work/test/wsdl/interop4/groupG/dime/rpc"
             overwrite="yes"/>
  -    -->          
  +
       <!-- compile the skeletons -->
       <javac srcdir="${build.dir}/work"
         destdir="${build.dest}" debug="on">
  
  
  
  1.3       +22 -11    
xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/DimeRPCInteropTestCase.java
  
  Index: DimeRPCInteropTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/interop4/groupG/dime/rpc/DimeRPCInteropTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DimeRPCInteropTestCase.java       28 Dec 2002 17:59:06 -0000      1.2
  +++ DimeRPCInteropTestCase.java       30 Dec 2002 14:36:44 -0000      1.3
  @@ -7,7 +7,10 @@
   
   package test.wsdl.interop4.groupG.dime.rpc;
   
  +import org.apache.axis.attachments.OctetStream;
  +
   import java.net.URL;
  +import java.util.Arrays;
   
   public class DimeRPCInteropTestCase extends junit.framework.TestCase {
       public DimeRPCInteropTestCase(java.lang.String name) {
  @@ -32,10 +35,11 @@
           assertTrue("binding is null", binding != null);
   
           // Test operation
  -        org.apache.axis.attachments.OctetStream input = new 
org.apache.axis.attachments.OctetStream("EchoAttachment".getBytes());
  -        org.apache.axis.attachments.OctetStream output = null;
  +        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 test2DimeRPCSoapPortEchoAttachments() throws Exception {
  @@ -50,13 +54,17 @@
           }
           assertTrue("binding is null", binding != null);
   
  +        OctetStream[] input = new OctetStream[2];
  +
  +        input[0] = new OctetStream("EchoAttachments0".getBytes());
  +        input[1] = new OctetStream("EchoAttachments1".getBytes());
  +        
           // Test operation
  -        test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary[] input = new 
test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary[2];
  -        input[0] = new 
test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary("EchoAttachments0".getBytes());
  -        input[1] = new 
test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary("EchoAttachments1".getBytes());
  -        test.wsdl.interop4.groupG.dime.rpc.xsd.ReferencedBinary[] output = null;
  +        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 test3DimeRPCSoapPortEchoAttachmentAsBase64() throws Exception {
  @@ -71,11 +79,12 @@
           }
           assertTrue("binding is null", binding != null);
   
  -        org.apache.axis.attachments.OctetStream input = new 
org.apache.axis.attachments.OctetStream("EchoAttachmentAsBase64".getBytes());
  +        OctetStream input = new OctetStream("EchoAttachmentAsBase64".getBytes()); 
           // Test operation
  -        byte[] value = null;
  -        value = binding.echoAttachmentAsBase64(input);
  +        byte[] output = null;
  +        output = binding.echoAttachmentAsBase64(input);
           // TBD - validate results
  +        assertTrue(Arrays.equals(input.getBytes(), output));
       }
   
       public void test4DimeRPCSoapPortEchoBase64AsAttachment() throws Exception {
  @@ -90,11 +99,12 @@
           }
           assertTrue("binding is null", binding != null);
   
  -        byte[] input = "EchoBase64AsAttachment".getBytes();
  +        byte[] input = "EchoBase64AsAttachment".getBytes(); 
           // Test operation
  -        org.apache.axis.attachments.OctetStream output = null;
  +        OctetStream output = null;
           output = binding.echoBase64AsAttachment(input);
           // TBD - validate results
  +        assertTrue(Arrays.equals(input, output.getBytes()));
       }
   
       public void test5DimeRPCSoapPortEchoUnrefAttachments() throws Exception {
  @@ -132,6 +142,7 @@
           java.lang.String output = null;
           output = binding.echoAttachmentAsString(input);
           // TBD - validate results
  +        assertEquals(input, output);
       }
   
       public static URL url = null;
  
  
  
  1.3       +1 -1      
xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/AttachmentsBindingImpl.java
  
  Index: AttachmentsBindingImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/AttachmentsBindingImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttachmentsBindingImpl.java       25 Dec 2002 23:28:46 -0000      1.2
  +++ AttachmentsBindingImpl.java       30 Dec 2002 14:36:45 -0000      1.3
  @@ -14,7 +14,7 @@
           return in;
       }
   
  -    public OctetStream echoAttachments(OctetStream in) throws 
java.rmi.RemoteException {
  +    public OctetStream[] echoAttachments(OctetStream in[]) throws 
java.rmi.RemoteException {
           return in;
       }
   
  
  
  
  1.5       +3 -0      xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/build.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- build.xml 25 Dec 2002 23:28:46 -0000      1.4
  +++ build.xml 30 Dec 2002 14:36:45 -0000      1.5
  @@ -55,6 +55,7 @@
       <wsdl2java url="${axis.home}/test/wsdl/interop4/groupG/mime/rpc/mime-rpc.wsdl"
                  output="${root.dir}/build/work" 
                  skeletonDeploy="yes"
  +               timeout="-1"
                  testCase="yes"
                  serverSide="yes">
           <mapping namespace="http://soapinterop.org/attachments/wsdl"; 
package="test.wsdl.interop4.groupG.mime.rpc"/>
  @@ -70,12 +71,14 @@
       </wsdl2java>
   
       <mkdir dir="${build.dest}"/>
  +
       <copy 
file="${axis.home}/test/wsdl/interop4/groupG/mime/rpc/MimeRPCInteropTestCase.java"
            todir="${root.dir}/build/work/test/wsdl/interop4/groupG/mime/rpc"
            overwrite="yes"/>
       <copy 
file="${axis.home}/test/wsdl/interop4/groupG/mime/rpc/AttachmentsBindingImpl.java"
            todir="${root.dir}/build/work/test/wsdl/interop4/groupG/mime/rpc"
            overwrite="yes"/>
  +
       <!-- compile the skeletons -->
       <javac srcdir="${build.dir}/work"
         destdir="${build.dest}" debug="on">
  
  
  
  1.4       +3 -4      
xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/MimeRPCInteropTestCase.java
  
  Index: MimeRPCInteropTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/interop4/groupG/mime/rpc/MimeRPCInteropTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MimeRPCInteropTestCase.java       25 Dec 2002 23:28:46 -0000      1.3
  +++ MimeRPCInteropTestCase.java       30 Dec 2002 14:36:45 -0000      1.4
  @@ -60,11 +60,10 @@
           
           // Test operation
           OctetStream[] output = null;
  -        // TODO: Fix this echoAttachments sig is wrong.
  -        //output = binding.echoAttachments(input);
  +        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()));
  +        assertTrue(Arrays.equals(input[0].getBytes(), output[0].getBytes()));
  +        assertTrue(Arrays.equals(input[1].getBytes(), output[1].getBytes()));
       }
   
       public void test3MimeRPCSoapPortEchoAttachmentAsBase64() throws Exception {
  
  
  
  1.9       +4 -4      
xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BindingEntry.java
  
  Index: BindingEntry.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BindingEntry.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BindingEntry.java 28 Dec 2002 17:59:06 -0000      1.8
  +++ BindingEntry.java 30 Dec 2002 14:36:45 -0000      1.9
  @@ -191,13 +191,13 @@
        * Get the mime mapping for the given parameter name.
        * If there is none, this returns null.
        */
  -    public String getMIMEType(String operationName, String parameterName) {
  +    public MimeInfo getMIMEInfo(String operationName, String parameterName) {
           Map opMap = (Map) mimeTypes.get(operationName);
           if (opMap == null) {
               return null;
           }
           else {
  -            return (String) opMap.get(parameterName);
  +            return (MimeInfo) opMap.get(parameterName);
           }
       } // getMIMEType
   
  @@ -211,13 +211,13 @@
       /**
        * Set the mime mapping for the given parameter name.
        */
  -    public void setMIMEType(String operationName, String parameterName, String 
type) {
  +    public void setMIMEInfo(String operationName, String parameterName, String 
type, String dims) {
           Map opMap = (Map) mimeTypes.get(operationName);
           if (opMap == null) {
               opMap = new HashMap();
               mimeTypes.put(operationName, opMap);
           }
  -        opMap.put(parameterName, type);
  +        opMap.put(parameterName, new MimeInfo(type,dims));
       } // setMIMEType
   
       /**
  
  
  
  1.6       +6 -6      
xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Parameter.java
  
  Index: Parameter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Parameter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Parameter.java    9 Oct 2002 19:06:32 -0000       1.5
  +++ Parameter.java    30 Dec 2002 14:36:45 -0000      1.6
  @@ -74,7 +74,7 @@
       private String name;
   
       // The MIME type of this parameter, null if it isn't a MIME type.
  -    private String mimeType = null;
  +    private MimeInfo mimeInfo = null;
       
       private TypeEntry type;
       private byte mode = IN;
  @@ -86,7 +86,7 @@
   
       public String toString() {
           return "(" + type
  -                + (mimeType == null ? "" : "(" + mimeType + ")")
  +                + (mimeInfo == null ? "" : "(" + mimeInfo + ")")
                   + ", " + getName() + ", "
                   + (mode == IN ? "IN)" : mode == INOUT ? "INOUT)" : "OUT)"
                   + (inHeader ? "(IN soap:header)" : "")
  @@ -131,15 +131,15 @@
       /**
        * Get the MIME type of the parameter.
        */
  -    public String getMIMEType() {
  -        return mimeType;
  +    public MimeInfo getMIMEInfo() {
  +        return mimeInfo;
       } // getMIMEType
   
       /**
        * Set the MIME type of the parameter.
        */
  -    public void setMIMEType(String mimeType) {
  -        this.mimeType = mimeType;
  +    public void setMIMEInfo(MimeInfo mimeInfo) {
  +        this.mimeInfo = mimeInfo;
       } // setMIMEType
   
       /**
  
  
  
  1.64      +60 -18    
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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- SymbolTable.java  28 Dec 2002 17:59:06 -0000      1.63
  +++ SymbolTable.java  30 Dec 2002 14:36:45 -0000      1.64
  @@ -1377,8 +1377,8 @@
                                                    new String[] {partName,
                                                                  opName}));
                   }
  -                setMIMEType(param, bindingEntry == null ? null :
  -                        bindingEntry.getMIMEType(opName, partName));
  +                setMIMEInfo(param, bindingEntry == null ? null :
  +                        bindingEntry.getMIMEInfo(opName, partName));
                   if (bindingEntry != null &&
                       bindingEntry.isInHeaderPart(opName, partName)) {
                       param.setInHeader(true);
  @@ -1465,8 +1465,8 @@
                       Parameter p = new Parameter();
                       p.setQName(elem.getName());
                       p.setType(elem.getType());
  -                    setMIMEType(p, bindingEntry == null ? null :
  -                            bindingEntry.getMIMEType(opName, partName));
  +                    setMIMEInfo(p, bindingEntry == null ? null :
  +                            bindingEntry.getMIMEInfo(opName, partName));
                       if (bindingEntry.isInHeaderPart(opName, partName)) {
                           p.setInHeader(true);
                       }
  @@ -1486,8 +1486,8 @@
                   } else if (elementName != null) {
                       param.setType(getElement(elementName));
                   }
  -                setMIMEType(param, bindingEntry == null ? null :
  -                        bindingEntry.getMIMEType(opName, partName));
  +                setMIMEInfo(param, bindingEntry == null ? null :
  +                        bindingEntry.getMIMEInfo(opName, partName));
                   if (bindingEntry.isInHeaderPart(opName, partName)) {
                       param.setInHeader(true);
                   }
  @@ -1506,30 +1506,30 @@
        * 1.  From WSDL 1.1 MIME constructs on the binding (passed in);
        * 2.  From AXIS-specific xml MIME types.
        */
  -    private void setMIMEType(Parameter p, String mimeType) {
  +    private void setMIMEInfo(Parameter p, MimeInfo mimeInfo) {
           // If there is no binding MIME construct (ie., the mimeType parameter is
           // null), then get the MIME type from the AXIS-specific xml MIME type.
  -        if (mimeType == null) {
  +        if (mimeInfo == null) {
               QName mimeQName = p.getType().getQName();
               if (mimeQName.getNamespaceURI().equals(Constants.NS_URI_XMLSOAP)) {
                   if (Constants.MIME_IMAGE.equals(mimeQName)) {
  -                    mimeType = "image/jpeg";
  +                    mimeInfo = new MimeInfo("image/jpeg","");
                   }
                   else if (Constants.MIME_PLAINTEXT.equals(mimeQName)) {
  -                    mimeType = "text/plain";
  +                    mimeInfo = new MimeInfo("text/plain","");
                   }
                   else if (Constants.MIME_MULTIPART.equals(mimeQName)) {
  -                    mimeType = "multipart/related";
  +                    mimeInfo = new MimeInfo("multipart/related","");
                   }
                   else if (Constants.MIME_SOURCE.equals(mimeQName)) {
  -                    mimeType = "text/xml";
  +                    mimeInfo = new MimeInfo("text/xml","");
                   } 
                   else if (Constants.MIME_OCTETSTREAM.equals(mimeQName)) {
  -                    mimeType = "application/octetstream";
  +                    mimeInfo = new MimeInfo("application/octetstream","");
                   }
               }
           }
  -        p.setMIMEType(mimeType);
  +        p.setMIMEInfo(mimeInfo);
       } // setMIMEType
   
       /**
  @@ -1712,19 +1712,28 @@
                while(iterator.hasNext()){
                    Part part = (Part) iterator.next();
                    if(part != null){
  +                     String dims = "";
                        org.w3c.dom.Element element = null;
                        if(part.getTypeName() != null) {
  -                         Type partType = getType(part.getTypeName());
  +                         TypeEntry partType = getType(part.getTypeName());
  +                         if(partType.getDimensions().length()>0){
  +                             dims = partType.getDimensions();
  +                             partType = partType.getRefType();
  +                         }
                            element = (org.w3c.dom.Element) partType.getNode();
                        } else if(part.getElementName() != null) {
  -                         Element partElement = getElement(part.getElementName());
  +                         TypeEntry partElement = getElement(part.getElementName());
  +                         if(partElement.getDimensions().length()>0){
  +                             dims = partElement.getDimensions();
  +                             partElement = partElement.getRefType();
  +                         }
                            element = (org.w3c.dom.Element) partElement.getNode();
                        }
                        org.w3c.dom.Element e = 
(org.w3c.dom.Element)XMLUtils.findNode(element, new QName(Constants.URI_DIME_CONTENT, 
"mediaType"));
                        if(e != null){
                            String value = e.getAttribute("value");
                            bEntry.setOperationDIME(operation.getName());
  -                         bEntry.setMIMEType(operation.getName(), part.getName(), 
value);
  +                         bEntry.setMIMEInfo(operation.getName(), part.getName(), 
value, dims);
                        }
                    }
                }
  @@ -1822,7 +1831,8 @@
                   Object obj = j.next();
                   if (obj instanceof MIMEContent) {
                       MIMEContent content = (MIMEContent) obj;
  -                    bEntry.setMIMEType(op.getName(), content.getPart(), 
content.getType());
  +                    TypeEntry typeEntry = findPart(op, content.getPart());
  +                    bEntry.setMIMEInfo(op.getName(), content.getPart(), 
content.getType(), typeEntry.getDimensions());
                   }
                   else if (obj instanceof SOAPBody) {
                       String use = ((SOAPBody) obj).getUse();
  @@ -1839,6 +1849,38 @@
           return bodyType;
       } // addMIMETypes
   
  +    private TypeEntry findPart(Operation operation, String partName)
  +    {
  +        Map parts = operation.getInput().getMessage().getParts();                   
    
  +        Iterator iterator = parts.values().iterator();
  +        TypeEntry part = findPart(iterator, partName);
  +        
  +        if(part == null) {
  +            parts = operation.getOutput().getMessage().getParts();                  
     
  +            iterator = parts.values().iterator();
  +            part = findPart(iterator, partName);
  +        }
  +        return part;
  +    }
  +
  +    private TypeEntry findPart(Iterator iterator, String partName)
  +    {
  +        while(iterator.hasNext()){
  +            Part part = (Part) iterator.next();
  +            if(part != null){
  +                String typeName = part.getName();
  +                if(partName.equals(typeName)) {
  +                    if(part.getTypeName() != null) {
  +                        return getType(part.getTypeName());
  +                    } else if(part.getElementName() != null) {
  +                        return getElement(part.getElementName());
  +                    }
  +                }
  +             }
  +        }
  +        return null;
  +    }
  +    
       /**
        * Populate the symbol table with all of the ServiceEntry's from the Definition.
        */
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/MimeInfo.java
  
  Index: MimeInfo.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.axis.wsdl.symbolTable;
  
  public class MimeInfo {
      String type;
      String dims;
      public MimeInfo(String type, String dims){
          this.type = type;
          this.dims = dims;
      }
      public String getDimensions(){
          return this.dims;
      }
      public String getType(){
          return this.type;
      }
      public String toString() {
          return "(" + type + "," + dims + ")";
      }
  }
  
  
  
  1.196     +1 -1      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.195
  retrieving revision 1.196
  diff -u -r1.195 -r1.196
  --- Call.java 17 Dec 2002 00:01:35 -0000      1.195
  +++ Call.java 30 Dec 2002 14:36:45 -0000      1.196
  @@ -1289,7 +1289,7 @@
   
               // Get the javaType
               String javaType = null;
  -            if (parameters.returnParam.getMIMEType() != null) {
  +            if (parameters.returnParam.getMIMEInfo() != null) {
                   javaType = "javax.activation.DataHandler";
               }
               else {
  
  
  
  1.32      +1 -1      
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- JavaGeneratorFactory.java 11 Dec 2002 22:38:30 -0000      1.31
  +++ JavaGeneratorFactory.java 30 Dec 2002 14:36:46 -0000      1.32
  @@ -911,7 +911,7 @@
                   signature = signature + Utils.getParameterTypeName(p) + " " + 
javifiedName;
               }
               else {
  -                signature = signature + Utils.holder(p.getMIMEType(), p.getType(), 
emitter) + " "
  +                signature = signature + Utils.holder(p.getMIMEInfo(), p.getType(), 
emitter) + " "
                           + javifiedName;
               }
           }
  
  
  
  1.108     +17 -15    
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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- JavaStubWriter.java       28 Dec 2002 17:59:06 -0000      1.107
  +++ JavaStubWriter.java       30 Dec 2002 14:36:46 -0000      1.108
  @@ -65,6 +65,7 @@
   import org.apache.axis.wsdl.symbolTable.Parameters;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +import org.apache.axis.wsdl.symbolTable.MimeInfo;
   
   import javax.wsdl.Binding;
   import javax.wsdl.BindingOperation;
  @@ -76,6 +77,7 @@
   import javax.wsdl.PortType;
   import javax.wsdl.extensions.soap.SOAPOperation;
   import javax.xml.namespace.QName;
  +import javax.activation.DataHandler;
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.util.ArrayList;
  @@ -367,15 +369,14 @@
               for (int j = 0; j < parameters.list.size(); ++j) {
                   Parameter p = (Parameter) parameters.list.get(j);
   
  -                String mimeType = p.getMIMEType();
  -
                   // Get the QName representing the parameter type
                   QName paramType = Utils.getXSIType(p);
   
                   // Set the javaType to the name of the type
                   String javaType = null;
  -                if (mimeType != null) {
  -                    javaType = "javax.activation.DataHandler.class, ";
  +                if (p.getMIMEInfo() != null) {
  +                    MimeInfo mimeInfo = p.getMIMEInfo();
  +                    javaType = "javax.activation.DataHandler" + 
mimeInfo.getDimensions() + ".class, ";
                   }
                   else {
                       javaType = p.getType().getName();
  @@ -407,8 +408,9 @@
   
                   // Get the javaType
                   String javaType = null;
  -                if (parameters.returnParam.getMIMEType() != null) {
  -                    javaType = "javax.activation.DataHandler";
  +                if (parameters.returnParam.getMIMEInfo() != null) {
  +                    MimeInfo mimeInfo = parameters.returnParam.getMIMEInfo();
  +                    javaType = "javax.activation.DataHandler" + 
mimeInfo.getDimensions();
                   }
                   else {
                       javaType = parameters.returnParam.getType().getName();
  @@ -775,7 +777,7 @@
                   if (p.getMode() != Parameter.IN) {
                       javifiedName += ".value";
                   }
  -                if (p.getMIMEType() == null) {
  +                if (p.getMIMEInfo() == null) {
                       javifiedName = Utils.wrapPrimitiveType(
                               p.getType(), javifiedName);
                   }
  @@ -797,7 +799,7 @@
               if (allOuts == 1) {
                   if (parms.returnParam != null) {
                       writeOutputAssign(pw, "return ", parms.returnParam.getType(),
  -                            parms.returnParam.getMIMEType(), "_resp");
  +                            parms.returnParam.getMIMEInfo() , "_resp");
                   }
                   else {
                       // The resp object must go into a holder
  @@ -813,7 +815,7 @@
                       pw.println("            java.util.Map _output;");
                       pw.println("            _output = _call.getOutputParams();");
                       writeOutputAssign(pw, javifiedName + ".value = ",
  -                                      p.getType(), p.getMIMEType(),
  +                                      p.getType(), p.getMIMEInfo(),
                                         "_output.get(" + qnameName + ")");
                   }
               }
  @@ -827,13 +829,13 @@
                       String qnameName = Utils.getNewQName(p.getQName());
                       if (p.getMode() != Parameter.IN) {
                           writeOutputAssign(pw, javifiedName + ".value = ",
  -                                          p.getType(), p.getMIMEType(),
  +                                          p.getType(), p.getMIMEInfo(),
                                             "_output.get(" + qnameName + ")");
                       }
                   }
                   if (parms.returnParam != null) {
                       writeOutputAssign(pw, "return ", parms.returnParam.getType(),
  -                            parms.returnParam.getMIMEType(), "_resp");
  +                            parms.returnParam.getMIMEInfo(), "_resp");
                   }
   
               }
  @@ -851,7 +853,7 @@
        *
        */
       private void writeOutputAssign(PrintWriter pw, String target,
  -                                   TypeEntry type, String mimeType,
  +                                   TypeEntry type, MimeInfo mimeInfo,
                                      String source) {
           if (type != null && type.getName() != null) {
               // Try casting the output to the expected output.
  @@ -859,17 +861,17 @@
               pw.println("            try {");
   
               pw.println("                " + target +
  -                    Utils.getResponseString(type, mimeType, source));
  +                    Utils.getResponseString(type, mimeInfo, source));
   
               pw.println("            } catch (java.lang.Exception _exception) {");
               pw.println("                " + target +
  -                    Utils.getResponseString(type, mimeType,
  +                    Utils.getResponseString(type, mimeInfo,
                       "org.apache.axis.utils.JavaUtils.convert(" +
                       source + ", " + type.getName() + ".class)"));
               pw.println("            }");
           } else {
               pw.println("              " + target +
  -                       Utils.getResponseString(type, mimeType, source));
  +                       Utils.getResponseString(type, mimeInfo, source));
           }
       }
   
  
  
  
  1.48      +2 -4      
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- JavaTestCaseWriter.java   11 Dec 2002 22:38:30 -0000      1.47
  +++ JavaTestCaseWriter.java   30 Dec 2002 14:36:46 -0000      1.48
  @@ -196,7 +196,7 @@
                   pw.print(Utils.getParameterTypeName(params.returnParam));
                   pw.print(" value = ");
   
  -                if (params.returnParam.getMIMEType() == null &&
  +                if (params.returnParam.getMIMEInfo() == null &&
                           Utils.isPrimitiveType(returnType)) {
                       if ("boolean".equals(returnType.getName())) {
                           pw.println("false;");
  @@ -229,13 +229,11 @@
                   }
   
                   Parameter param = (Parameter) iparam.next();
  -                String paramType = param.getType().getName();
  -                String mimeType = param.getMIMEType();
                   String suffix = "";
   
                   // if we have an out or in/out, we are passing in a holder
                   if (param.getMode() != Parameter.IN) {
  -                    pw.print("new " + Utils.holder(mimeType, param.getType(), 
emitter)
  +                    pw.print("new " + Utils.holder(param.getMIMEInfo(), 
param.getType(), emitter)
                               + "(");
                       suffix = ")";
                   }
  
  
  
  1.65      +34 -20    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.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Utils.java        25 Dec 2002 23:28:47 -0000      1.64
  +++ Utils.java        30 Dec 2002 14:36:46 -0000      1.65
  @@ -66,6 +66,7 @@
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +import org.apache.axis.wsdl.symbolTable.MimeInfo;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
  @@ -94,26 +95,28 @@
       /**
        * Given a type, return the Java mapping of that type's holder.
        */
  -    public static String holder(String mimeType, TypeEntry type, Emitter emitter) {
  +    public static String holder(MimeInfo mimeInfo, TypeEntry type, Emitter emitter) 
{
  +        String mimeType = mimeInfo == null ? null : mimeInfo.getType();
  +        String mimeDimensions = mimeInfo == null ? "" : mimeInfo.getDimensions();
   
           // Add the holders that JAX-RPC forgot about - the MIME type holders.
           if (mimeType != null) {
               if (mimeType.equals("image/gif") ||
                   mimeType.equals("image/jpeg")) {
  -                return "org.apache.axis.holders.ImageHolder";
  +                return "org.apache.axis.holders.ImageHolder" + mimeDimensions;
               }
               else if (mimeType.equals("text/plain")) {
  -                return "javax.xml.rpc.holders.StringHolder";
  +                return "javax.xml.rpc.holders.StringHolder" + mimeDimensions;
               }
               else if (mimeType.startsWith("multipart/")) {
  -                return "org.apache.axis.holders.MimeMultipartHolder";
  +                return "org.apache.axis.holders.MimeMultipartHolder" + 
mimeDimensions;
               }
               else if (mimeType.startsWith("application/octetstream")) {
  -                return "org.apache.axis.holders.OctetStreamHolder";
  +                return "org.apache.axis.holders.OctetStreamHolder" + mimeDimensions;
               }
               else if (mimeType.equals("text/xml") ||
                        mimeType.equals("application/xml")) {
  -                return "org.apache.axis.holders.SourceHolder";
  +                return "org.apache.axis.holders.SourceHolder" + mimeDimensions;
               }
           }
   
  @@ -506,27 +509,29 @@
        * Return the Object variable 'var' cast to the appropriate type
        * doing the right thing for the primitive types.
        */
  -    public static String getResponseString(TypeEntry type, String mimeType,
  +    public static String getResponseString(TypeEntry type, MimeInfo mimeInfo,
               String var) {
  +        String mimeType = mimeInfo == null ? null : mimeInfo.getType();
  +        String mimeDimensions = mimeInfo == null ? "" : mimeInfo.getDimensions();
           if (type == null) {
               return ";";
           }
           else if (mimeType != null) {
               if (mimeType.equals("image/jpeg")) {
  -                return "(java.awt.Image) " + var + ";";
  +                return "(java.awt.Image" + mimeDimensions + ") " + var + ";";
               }
               else if (mimeType.equals("text/plain")) {
  -                return "(java.lang.String) " + var + ";";
  +                return "(java.lang.String" + mimeDimensions + ") " + var + ";";
               }
               else if (mimeType.equals("text/xml") ||
                        mimeType.equals("application/xml")) {
  -                return "(javax.xml.transform.Source) " + var + ";";
  +                return "(javax.xml.transform.Source" + mimeDimensions + ") " + var 
+ ";";
               }
               else if (mimeType.startsWith("multipart/")) {
  -                return "(javax.mail.internet.MimeMultipart) " + var + ";";
  +                return "(javax.mail.internet.MimeMultipart" + mimeDimensions + ") " 
+ var + ";";
               }
               else if (mimeType.startsWith("application/octetstream")) {
  -                return "(org.apache.axis.attachments.OctetStream) " + var + ";";
  +                return "(org.apache.axis.attachments.OctetStream" + mimeDimensions 
+ ") " + var + ";";
               }
               else {
                   return "(" + type.getName() + ") " + var + ";";
  @@ -627,15 +632,17 @@
        * use the name of the type itself.
        */
       public static String getParameterTypeName(Parameter parm) {
  -        String mime = parm.getMIMEType();
           String ret;
  -        if (mime == null) {
  +        if (parm.getMIMEInfo() == null) {
               ret = parm.getType().getName();
           }
           else {
  +            String mime = parm.getMIMEInfo().getType();
               ret = JavaUtils.mimeToJava(mime);
               if (ret == null) {
                   ret = parm.getType().getName();
  +            } else {
  +                ret += parm.getMIMEInfo().getDimensions();
               }
           }
           return ret;
  @@ -648,8 +655,8 @@
        * @return the QName of the parameter's xsi type
        */
       public static QName getXSIType(Parameter param) {
  -        if (param.getMIMEType() != null) {
  -            return getMIMETypeQName(param.getMIMEType());
  +        if (param.getMIMEInfo() != null) {
  +            return getMIMETypeQName(param.getMIMEInfo().getType());
           }
           return getXSIType(param.getType());
       } // getXSIType
  @@ -740,7 +747,7 @@
           if (parameters != null) {
               for (int idx = 0; idx < parameters.list.size(); ++idx) {
                   Parameter p = (Parameter) parameters.list.get(idx);
  -                if (p.getMIMEType() != null) {
  +                if (p.getMIMEInfo() != null) {
                       return true;
                   }
               }
  @@ -817,7 +824,8 @@
                                            BooleanHolder bThrow) {
           
           String paramType = param.getType().getName();
  -        String mimeType = param.getMIMEType();
  +        String mimeType = param.getMIMEInfo() == null ? null : 
param.getMIMEInfo().getType();
  +        String mimeDimensions = param.getMIMEInfo() == null ? "" : 
param.getMIMEInfo().getDimensions();
           String out = null;
           
           // Handle mime types
  @@ -828,10 +836,16 @@
               }
               else if (mimeType.equals("text/xml") ||
                       mimeType.equals("application/xml")) {
  -                return "new javax.xml.transform.stream.StreamSource()";
  +                if(mimeDimensions.length() <= 0)
  +                    return "new javax.xml.transform.stream.StreamSource()";
  +                else
  +                    return "new javax.xml.transform.stream.StreamSource[0]";
               }
               else if (mimeType.equals("application/octetstream")) {
  -                return "new org.apache.axis.attachments.OctetStream()";
  +                if(mimeDimensions.length() <= 0)
  +                    return "new org.apache.axis.attachments.OctetStream()";
  +                else
  +                    return "new org.apache.axis.attachments.OctetStream[0]";
               }
               else {
                   return "new " + Utils.getParameterTypeName(param) + "()";
  
  
  
  1.2       +10 -1     
xml-axis/java/src/org/apache/axis/encoding/ser/OctetStreamDataHandlerDeserializer.java
  
  Index: OctetStreamDataHandlerDeserializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/OctetStreamDataHandlerDeserializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OctetStreamDataHandlerDeserializer.java   25 Dec 2002 23:28:47 -0000      1.1
  +++ OctetStreamDataHandlerDeserializer.java   30 Dec 2002 14:36:46 -0000      1.2
  @@ -57,12 +57,15 @@
   
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.attachments.OctetStream;
   import org.apache.commons.logging.Log;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   
   import javax.activation.DataHandler;
   import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.ByteArrayOutputStream;
   
   /**
    * application/octetstream DataHandler Deserializer
  @@ -82,7 +85,13 @@
           if (getValue() instanceof DataHandler) {
               try {
                   DataHandler dh = (DataHandler) getValue();
  -                setValue(dh.getContent());
  +                InputStream in = dh.getInputStream();
  +                ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +                int byte1 = -1;
  +                while((byte1 = in.read())!=-1)
  +                    baos.write(byte1);
  +                OctetStream os = new OctetStream(baos.toByteArray());
  +                setValue(os);
               } catch (IOException ioe) {
               }
           }
  
  
  


Reply via email to