axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/types ComprehensiveTypes.wsdl
Date Fri, 07 Dec 2001 18:32:44 GMT
butek       01/12/07 10:32:44

  Modified:    java/src/org/apache/axis/wsdl JavaSkelWriter.java
                        JavaStubWriter.java JavaWriterFactory.java
                        Namespaces.java Utils.java
               java/test/wsdl Wsdl2javaTestSuite.xml
  Added:       java/src/javax/xml/rpc/holders ByteArrayHolder.java
               java/test/wsdl/types ComprehensiveTypes.wsdl
  Log:
  First cut at a comprehensive XML schema types test - the primitive types - and some
  fixes that are necessary to get the generated code to compile.
  
  Revision  Changes    Path
  1.1                  xml-axis/java/src/javax/xml/rpc/holders/ByteArrayHolder.java
  
  Index: ByteArrayHolder.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 apache@apache.org.
   *
   * 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 javax.xml.rpc.holders;
  
  /**
   * Class ByteArrayHolder
   *
   * @version 0.1
   */
  public final class ByteArrayHolder implements java.io.Serializable {
  
      /** Field _value           */
      public byte[] _value;
  
      /**
       * Constructor ByteArrayHolder
       */
      public ByteArrayHolder() {}
  
      /**
       * Constructor ByteArrayHolder
       *
       * @param value
       */
      public ByteArrayHolder(byte[] value) {
          this._value = value;
      }
  }
  
  
  
  
  
  1.13      +2 -2      xml-axis/java/src/org/apache/axis/wsdl/JavaSkelWriter.java
  
  Index: JavaSkelWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaSkelWriter.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JavaSkelWriter.java	2001/12/06 13:11:53	1.12
  +++ JavaSkelWriter.java	2001/12/07 18:32:43	1.13
  @@ -175,7 +175,7 @@
   
               String holder = Utils.holder(p.type);
               if (p.mode == Parameter.INOUT) {
  -                pw.println("        " + holder + " " + p.name + "Holder = new " + holder
+ "(" + p.name + ");");
  +                pw.println("        " + holder + " " + p.name + "Holder = new " + holder
+ "(" + Utils.xmlNameToJava(p.name) + ");");
               }
               else if (p.mode == Parameter.OUT) {
                   pw.println("        " + holder + " " + p.name + "Holder = new " + holder
+ "();");
  @@ -197,7 +197,7 @@
               Parameter p = (Parameter) parms.list.get(i);
   
               if (p.mode == Parameter.IN)
  -                call = call + p.name;
  +                call = call + Utils.xmlNameToJava(p.name);
               else
                   call = call + p.name + "Holder";
           }
  
  
  
  1.22      +14 -6     xml-axis/java/src/org/apache/axis/wsdl/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaStubWriter.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JavaStubWriter.java	2001/12/05 21:45:09	1.21
  +++ JavaStubWriter.java	2001/12/07 18:32:43	1.22
  @@ -420,10 +420,11 @@
               }
               else
                   needComma = true;
  +            String javifiedName = Utils.xmlNameToJava(p.name);
               if (p.mode == Parameter.IN)
  -                pw.print(wrapPrimitiveType(p.type, p.name));
  +                pw.print(wrapPrimitiveType(p.type, javifiedName));
               else if (p.mode == Parameter.INOUT)
  -                pw.print(wrapPrimitiveType(p.type, p.name + "._value"));
  +                pw.print(wrapPrimitiveType(p.type, javifiedName + "._value"));
           }
           pw.println("});");
           pw.println();
  @@ -441,9 +442,10 @@
                       int i = 0;
                       Parameter p = (Parameter) parms.list.get(i);
   
  -                    while (p.mode != Parameter.INOUT)
  +                    while (p.mode != Parameter.INOUT) {
                           p = (Parameter) parms.list.get(++i);
  -                    pw.println ("            " + p.name + "._value = " + getResponseString(p.type,
"resp"));
  +                    }
  +                    pw.println ("            " + Utils.xmlNameToJava(p.name) + "._value
= " + getResponseString(p.type, "resp"));
                   }
                   else {
                       // (parms.outputs == 1)
  @@ -472,13 +474,19 @@
                   boolean firstInoutIsResp = (parms.outputs == 0);
                   for (int i = 0; i < parms.list.size (); ++i) {
                       Parameter p = (Parameter) parms.list.get (i);
  +                    String javifiedName = Utils.xmlNameToJava(p.name);
                       if (p.mode != Parameter.IN) {
                           if (firstInoutIsResp) {
                               firstInoutIsResp = false;
  -                            pw.println ("            " + p.name + "._value = " + getResponseString(p.type,
 "resp"));
  +                            pw.println ("            " + javifiedName
  +                                    + "._value = "
  +                                    + getResponseString(p.type,  "resp"));
                           }
                           else {
  -                            pw.println ("            " + p.name + "._value = " + getResponseString(p.type,
"((org.apache.axis.message.RPCParam) output.get(" + outdex++ + ")).getValue()"));
  +                            pw.println ("            " + javifiedName
  +                                    + "._value = " + getResponseString(p.type,
  +                                    "((org.apache.axis.message.RPCParam) output.get("
  +                                    + outdex++ + ")).getValue()"));
                           }
                       }
   
  
  
  
  1.15      +9 -5      xml-axis/java/src/org/apache/axis/wsdl/JavaWriterFactory.java
  
  Index: JavaWriterFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaWriterFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JavaWriterFactory.java	2001/12/06 13:11:53	1.14
  +++ JavaWriterFactory.java	2001/12/07 18:32:43	1.15
  @@ -305,17 +305,21 @@
               }
               else
                   needComma = true;
  +
  +            String javifiedName = Utils.xmlNameToJava(p.name);
               if (p.mode == Parameter.IN) {
  -                signature = signature + p.type.getName() + " " + p.name;
  -                skelSig = skelSig + p.type.getName() + " " + p.name;
  +                signature = signature + p.type.getName() + " " + javifiedName;
  +                skelSig = skelSig + p.type.getName() + " " + javifiedName;
               }
               else if (p.mode == Parameter.INOUT) {
  -                signature = signature + Utils.holder(p.type) + " " + p.name;
  -                skelSig = skelSig + p.type.getName() + " " + p.name;
  +                signature = signature + Utils.holder(p.type) + " " +
  +                        javifiedName;
  +                skelSig = skelSig + p.type.getName() + " " + javifiedName;
               }
               else// (p.mode == Parameter.OUT)
               {
  -                signature = signature + Utils.holder(p.type) + " " + p.name;
  +                signature = signature + Utils.holder(p.type) + " " +
  +                        javifiedName;
               }
           }
           signature = signature + ") throws java.rmi.RemoteException";
  
  
  
  1.14      +3 -1      xml-axis/java/src/org/apache/axis/wsdl/Namespaces.java
  
  Index: Namespaces.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Namespaces.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Namespaces.java	2001/12/07 16:33:03	1.13
  +++ Namespaces.java	2001/12/07 18:32:43	1.14
  @@ -128,7 +128,9 @@
        */
       public String toDir(String pkg) {
           String dir = null;
  -        pkg = pkg.replace('.', File.separatorChar);
  +        if (pkg != null) {
  +            pkg = pkg.replace('.', File.separatorChar);
  +        }
           if (root == null) {
               dir = pkg;
           }
  
  
  
  1.23      +19 -10    xml-axis/java/src/org/apache/axis/wsdl/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Utils.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Utils.java	2001/12/07 16:33:03	1.22
  +++ Utils.java	2001/12/07 18:32:43	1.23
  @@ -438,16 +438,19 @@
           String hostname = null;
   
           // get the target namespace of the document
  -         try {
  -             hostname = new URL(namespace).getHost();
  -         }
  -         catch (MalformedURLException e) {
  -           if (namespace.indexOf(":") > -1) {
  -             hostname = namespace.substring(namespace.indexOf(":") + 1);
  -             if (hostname.indexOf("/") > -1)
  -               hostname = hostname.substring(0, hostname.indexOf("/") );
  -           }
  -         }
  +        try {
  +            hostname = new URL(namespace).getHost();
  +        }
  +        catch (MalformedURLException e) {
  +            if (namespace.indexOf(":") > -1) {
  +                hostname = namespace.substring(namespace.indexOf(":") + 1);
  +                if (hostname.indexOf("/") > -1)
  +                    hostname = hostname.substring(0, hostname.indexOf("/") );
  +            }
  +            else {
  +                hostname = namespace;
  +            }
  +        }
   
           // if we didn't file a hostname, bail
           if (hostname == null) {
  @@ -492,11 +495,17 @@
           else if (typeValue.equals("java.math.BigDecimal")) {
               return "javax.xml.rpc.holders.BigDecimalHolder";
           }
  +        else if (typeValue.equals("java.math.BigInteger")) {
  +            return "javax.xml.rpc.holders.BigIntegerHolder";
  +        }
           else if (typeValue.equals("java.util.Date")) {
               return "javax.xml.rpc.holders.DateHolder";
           }
           else if (typeValue.equals("javax.xml.rpc.namespace.QName")) {
               return "javax.xml.rpc.holders.QNameHolder";
  +        }
  +        else if (typeValue.equals("byte[]")) {
  +            return "javax.xml.rpc.holders.ByteArrayHolder";
           }
           else if (typeValue.equals("int")
                   || typeValue.equals("long")
  
  
  
  1.41      +7 -0      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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Wsdl2javaTestSuite.xml	2001/12/07 16:33:03	1.40
  +++ Wsdl2javaTestSuite.xml	2001/12/07 18:32:44	1.41
  @@ -333,6 +333,13 @@
           <mapping namespace="http://test.com/reference" package="test.filegen"/>
       </wsdl2java>
   
  +    <!-- This is (OK, "will be") a comprehensive test of XML schema types -->
  +    <wsdl2java url="test/wsdl/types/ComprehensiveTypes.wsdl"
  +               output="build/work"
  +               skeleton="yes"
  +               testcase="no">
  +    </wsdl2java>
  +
       <!--
       <wsdl2java url="http://www.lemurlabs.com/projects/soap/fortune/FortuneService.wsdl"
                  output="build/work"
  
  
  
  1.1                  xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
  
  Index: ComprehensiveTypes.wsdl
  ===================================================================
  <?xml version="1.0" ?>
  
  <definitions 
      name="comprehensive types test"
      targetNamespace="comprehensive.types.test"
      xmlns:tns="comprehensive.types.test"
      xmlns:typens="comprehensive.types"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns="http://schemas.xmlsoap.org/wsdl/">
  
    <!-- type defs -->
    <types>
      <xsd:schema 
          targetNamespace="comprehensive.types"
          xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  
        <xsd:simpleType name="enum">
          <xsd:restriction base="xsd:string">
            <xsd:enumeration value="one"/>                      
            <xsd:enumeration value="two"/>                    
            <xsd:enumeration value="three"/>                    
          </xsd:restriction>
        </xsd:simpleType>
  
        <xsd:complexType name="complexAll">
          <xsd:all>
            <xsd:element name="areaCode" type="xsd:int"/>
            <xsd:element name="exchange" type="xsd:string"/>
            <xsd:element name="number" type="xsd:string"/>
          </xsd:all>
        </xsd:complexType>
  
        <xsd:complexType name="complexSequence">
          <xsd:sequence>
            <xsd:element name="areaCode" type="xsd:int"/>
            <xsd:element name="exchange" type="xsd:string"/>
            <xsd:element name="number" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
  
      </xsd:schema>
    </types>
  
    <!-- message declns -->
    <message name="empty"/>
  
    <message name="allPrimitives">
      <part name="string" type="xsd:string"/>
      <part name="integer" type="xsd:integer"/>
      <part name="int" type="xsd:int"/>
      <part name="long" type="xsd:long"/>
      <part name="short" type="xsd:short"/>
      <part name="decimal" type="xsd:decimal"/>
      <part name="float" type="xsd:float"/>
      <part name="double" type="xsd:double"/>
      <part name="boolean" type="xsd:boolean"/>
      <part name="byte" type="xsd:byte"/>
      <part name="QName" type="xsd:QName"/>
      <part name="dateTime" type="xsd:dateTime"/>
      <part name="base64Binary" type="xsd:base64Binary"/>
      <part name="hexBinary" type="xsd:hexBinary"/>
      <part name="soapString" type="soapenc:string"/>
      <part name="soapBoolean" type="soapenc:boolean"/>
      <part name="soapFloat" type="soapenc:float"/>
      <part name="soapDouble" type="soapenc:double"/>
      <part name="soapDecimal" type="soapenc:decimal"/>
      <part name="soapInt" type="soapenc:int"/>
      <part name="soapShort" type="soapenc:short"/>
      <part name="soapBase64" type="soapenc:base64"/>
    </message>
  
    <!-- port type declns -->
    <portType name="TypeTest">
      <operation name="allPrimitivesIn">
        <input message="tns:allPrimitives"/>
        <output message="tns:empty"/>
      </operation>
      <operation name="allPrimitivesInout">
        <input message="tns:allPrimitives"/>
        <output message="tns:allPrimitives"/>
      </operation>
      <operation name="allPrimitivesOut">
        <input message="tns:empty"/>
        <output message="tns:allPrimitives"/>
      </operation>
    </portType>
  
    <!-- binding declns -->
    <binding name="TypeTestBinding" type="tns:TypeTest">
      <soap:binding
          style="rpc"
          transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="allPrimitivesIn">
        <soap:operation soapAction=""/>
        <input>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>
        <output>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
      </operation>
      <operation name="allPrimitivesInout">
        <soap:operation soapAction=""/>
        <input>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>
        <output>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
      </operation>
      <operation name="allPrimitivesOut">
        <soap:operation soapAction=""/>
        <input>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>
        <output>
          <soap:body
              use="encoded"
              namespace=""
              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
      </operation>
    </binding>
  
    <!-- service decln -->
    <service name="TypeTestService">
      <port name="TypeTest" binding="tns:TypeTestBinding">
        <soap:address location="http://localhost:8080/axis/services/TypeTest"/>
      </port>
    </service>
  
  </definitions>
  
  
  
  

Mime
View raw message