You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Tom Jordahl <to...@macromedia.com> on 2002/05/16 20:17:05 UTC

RE: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava E mitter.java

Rich,

This is kinda cool, but why do we need this switch?  Particularly the NONE option.
I am +1, but would like to know the rationale behind it.

--
Tom Jordahl
Macromedia


-----Original Message-----
From: scheu@apache.org [mailto:scheu@apache.org]
Sent: Thursday, May 16, 2002 1:45 PM
To: xml-axis-cvs@apache.org
Subject: cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava
Emitter.java


scheu       02/05/16 10:45:00

  Modified:    java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/utils resources.properties
               java/src/org/apache/axis/wsdl Java2WSDL.java
               java/src/org/apache/axis/wsdl/fromJava Emitter.java
  Log:
  Fixed NPE in SOAPService.
  
  Added --soapAction option to Java2WSDL.  Option values are
     DEFAULT:  uses the information in the OperationDesc to set soapAction
               (which is probably "").  This is also the default.
     NONE:     forces soapAction=""
     OPERATION: sets the soapAction to the name of the operation.
  
  Revision  Changes    Path
  1.59      +3 -0      xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- SOAPService.java	23 Apr 2002 03:27:35 -0000	1.58
  +++ SOAPService.java	16 May 2002 17:45:00 -0000	1.59
  @@ -313,6 +313,9 @@
   
       public void setPropertyParent(Hashtable parent)
       {
  +        if (options == null) {
  +            options = new LockableHashtable();
  +        }
           ((LockableHashtable)options).setParent(parent);
       }
   
  
  
  
  1.99      +2 -0      xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- resources.properties	16 May 2002 12:54:36 -0000	1.98
  +++ resources.properties	16 May 2002 17:45:00 -0000	1.99
  @@ -838,3 +838,5 @@
   cantCreateBean00=Unable to create JavaBean of type {0}.  Missing default constructor?  Error was: {1}.
   faultDuringCleanup=AxisEngine faulted during cleanup!
   
  +j2woptsoapAction00=value of the operation's soapAction field. Values are DEFAULT, OPERATION or NONE. OPERATION forces soapAction to the name of the operation.  DEFAULT causes the soapAction to be set according to the operation's meta data (usually "").  NONE forces the soapAction to "".  The default is DEFAULT.
  +j2wBadSoapAction00=The value of --soapAction must be DEFAULT, NONE or OPERATION.
  
  
  
  1.17      +21 -1     xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java
  
  Index: Java2WSDL.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Java2WSDL.java	15 May 2002 21:47:43 -0000	1.16
  +++ Java2WSDL.java	16 May 2002 17:45:00 -0000	1.17
  @@ -95,6 +95,7 @@
       protected static final int METHODS_NOTALLOWED_OPT = 'x';
       protected static final int STOP_CLASSES_OPT = 'c';
       protected static final int TYPEMAPPING_OPT = 'T';
  +    protected static final int SOAPACTION_OPT = 'A';
   
       /**
        *  Define the understood options. Each CLOptionDescriptor contains:
  @@ -177,7 +178,11 @@
           new CLOptionDescriptor("typeMappingVersion",
                   CLOptionDescriptor.ARGUMENT_REQUIRED,
                   TYPEMAPPING_OPT,
  -                JavaUtils.getMessage("j2wopttypeMapping00"))
  +                JavaUtils.getMessage("j2wopttypeMapping00")),
  +        new CLOptionDescriptor("soapAction",
  +                CLOptionDescriptor.ARGUMENT_REQUIRED,
  +                SOAPACTION_OPT,
  +                JavaUtils.getMessage("j2woptsoapAction00"))
       };
   
       protected Emitter emitter;
  @@ -327,6 +332,21 @@
               }
               break;
               
  +        case SOAPACTION_OPT:
  +            value = option.getArgument();
  +            if (value.equalsIgnoreCase("DEFAULT")) {
  +                emitter.setSoapAction("DEFAULT");
  +            } else if (value.equalsIgnoreCase("OPERATION")) {
  +                emitter.setSoapAction("OPERATION");
  +            } else if (value.equalsIgnoreCase("NONE")) {
  +                emitter.setSoapAction("NONE");
  +            } else {
  +                System.out.println(JavaUtils.getMessage("j2wBadSoapAction00"));
  +            }
  +            break;
  +
  +        default: 
  +            break;
           }
       }        
   
  
  
  
  1.34      +32 -3     xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Emitter.java	15 May 2002 21:47:43 -0000	1.33
  +++ Emitter.java	16 May 2002 17:45:00 -0000	1.34
  @@ -1,4 +1,3 @@
  -
   /*
    * The Apache Software License, Version 1.1
    *
  @@ -143,6 +142,7 @@
   
       private ServiceDesc serviceDesc;
       private ServiceDesc serviceDesc2;
  +    private String soapAction = "DEFAULT";
   
       /**
        * Construct Emitter.
  @@ -732,9 +732,22 @@
           bindingOper.setOperation(oper);
   
           SOAPOperation soapOper = new SOAPOperationImpl();
  -        String soapAction = desc.getSoapAction();
  -        if (soapAction == null) {
  +
  +        
  +        // If the soapAction option is OPERATION, force
  +        // soapAction to the name of the operation. If NONE,
  +        // force soapAction to "".
  +        // Otherwise use the information in the operationDesc.
  +        String soapAction = "";
  +        if (getSoapAction().equals("OPERATION")) {
  +            soapAction = oper.getName();
  +        } else if (getSoapAction().equals("NONE")) {
               soapAction = "";
  +        } else {
  +            soapAction = desc.getSoapAction();
  +            if (soapAction == null) {
  +                soapAction = "";
  +            }
           }
           soapOper.setSoapActionURI(soapAction);
   
  @@ -1363,6 +1376,22 @@
        */
       public void setDescription(String description) {
           this.description = description;
  +    }
  +
  +    /**
  +     * Returns the soapAction option value
  +     * @return the String DEFAULT, NONE or OPERATION
  +     */
  +    public String getSoapAction() {
  +        return soapAction;
  +    }
  +
  +    /**
  +     * Sets the soapAction option value
  +     * @param must be DEFAULT, NONE, or OPERATION
  +     */
  +    public void setSoapAction(String value) {
  +        soapAction = value;
       }
   
       /**