gdaniels    2003/02/12 13:59:29

  Modified:    java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/enum Use.java
               java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java
               java/test/soap12 TestRPC.java
               java/test/wsdl/soap12/additional
                        WhiteMesaSoap12AddTestSvcTestCase.java
  Log:
  Better defaulting for Call's style / use / encodingStyle attributes.
  
  When you set Style to anything but RPC, we default the Use to LITERAL
  (unless Use has been explicitly set).
  
  Whenever either Style is set to RPC or Use is set to ENCODED, we
  default the encodingStyle to SOAP-ENC (for whichever version of SOAP
  you're using).  Otherwise we default to "" (no encoding).
  
  Got rid of Use.ENCODED12, since nothing was using it, it didn't seem to
  do anything, and all the tests pass without it.  Encoded is encoded,
  regardless of SOAP version...
  
  Fix add'l SOAP 1.2 tests to use the right namespace for certain args.
  
  Revision  Changes    Path
  1.202     +42 -8     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.201
  retrieving revision 1.202
  diff -u -r1.201 -r1.202
  --- Call.java 3 Feb 2003 02:32:52 -0000       1.201
  +++ Call.java 12 Feb 2003 21:59:28 -0000      1.202
  @@ -244,6 +244,11 @@
                                               ParameterMode.OUT,
                                               ParameterMode.INOUT };
       
  +    /** This is true when someone has called setEncodingStyle() */
  +    private boolean encodingStyleExplicitlySet = false;
  +    /** This is true when someone has called setOperationUse() */
  +    private boolean useExplicitlySet = false;
  +    
       /************************************************************************/
       /* Start of core JAX-RPC stuff                                          */
       /************************************************************************/
  @@ -572,10 +577,8 @@
        * @param operationStyle string designating style
        */
       public void setOperationStyle(String operationStyle) {
  -        if (operation == null) {
  -            operation = new OperationDesc();
  -        }
  -        operation.setStyle(Style.getStyle(operationStyle, Style.DEFAULT));
  +        Style style = Style.getStyle(operationStyle, Style.DEFAULT);
  +        setOperationStyle(style);
       } // setOperationStyle
       
       /**
  @@ -587,7 +590,28 @@
           if (operation == null) {
               operation = new OperationDesc();
           }
  +        
           operation.setStyle(operationStyle);
  +        
  +        // If no one has explicitly set the use, we should track
  +        // the style.  If it's non-RPC, default to LITERAL.
  +        if (!useExplicitlySet) {
  +            if (operationStyle != Style.RPC) {
  +                operation.setUse(Use.LITERAL);
  +            }
  +        }
  +        
  +        // If no one has explicitly set the encodingStyle, we should
  +        // track the style.  If it's RPC, default to SOAP-ENC, otherwise
  +        // default to "".
  +        if (!encodingStyleExplicitlySet) {
  +            String encStyle = "";
  +            if (operationStyle == Style.RPC) {
  +                // RPC style defaults to encoded, otherwise default to literal
  +                encStyle = msgContext.getSOAPConstants().getEncodingURI();
  +            }
  +            msgContext.setEncodingStyle(encStyle);
  +        }
       }
   
       /**
  @@ -605,10 +629,8 @@
        * @param operationUse string designating use
        */
       public void setOperationUse(String operationUse) {
  -        if (operation == null) {
  -            operation = new OperationDesc();
  -        }
  -        operation.setUse(Use.getUse(operationUse, Use.DEFAULT));
  +        Use use = Use.getUse(operationUse, Use.DEFAULT);
  +        setOperationUse(use);
       } // setOperationUse
       
       /**
  @@ -616,10 +638,21 @@
        * @param operationUse
        */ 
       public void setOperationUse(Use operationUse) {
  +        useExplicitlySet = true;
  +        
           if (operation == null) {
               operation = new OperationDesc();
           }
  +        
           operation.setUse(operationUse);        
  +        if (!encodingStyleExplicitlySet) {
  +            String encStyle = "";
  +            if (operationUse == Use.ENCODED) {
  +                // RPC style defaults to encoded, otherwise default to literal
  +                encStyle = msgContext.getSOAPConstants().getEncodingURI();
  +            }
  +            msgContext.setEncodingStyle(encStyle);
  +        }
       }
   
       /**
  @@ -668,6 +701,7 @@
        * @param namespaceURI URI of the encoding to use.
        */
       public void setEncodingStyle(String namespaceURI) {
  +        encodingStyleExplicitlySet = true;
           msgContext.setEncodingStyle(namespaceURI);
       }
   
  
  
  
  1.5       +0 -4      xml-axis/java/src/org/apache/axis/enum/Use.java
  
  Index: Use.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/enum/Use.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Use.java  21 Jan 2003 17:01:14 -0000      1.4
  +++ Use.java  12 Feb 2003 21:59:28 -0000      1.5
  @@ -71,11 +71,9 @@
   
       private static final Type type = new Type();
       
  -    public static final String ENCODED12_STR = "encoded12";
       public static final String ENCODED_STR = "encoded";
       public static final String LITERAL_STR = "literal";
    
  -    public static final Use ENCODED12 = type.getUse(ENCODED12_STR);
       public static final Use ENCODED = type.getUse(ENCODED_STR);
       public static final Use LITERAL = type.getUse(LITERAL_STR);
   
  @@ -119,8 +117,6 @@
                     Constants.URI_DEFAULT_SOAP_ENC),
               new Use(1, LITERAL_STR,
                     Constants.URI_LITERAL_ENC),
  -            new Use(2, ENCODED12_STR,
  -                  Constants.URI_SOAP12_ENC),
               });
           }
   
  
  
  
  1.74      +1 -1      
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- JavaDeployWriter.java     21 Jan 2003 17:01:12 -0000      1.73
  +++ JavaDeployWriter.java     12 Feb 2003 21:59:28 -0000      1.74
  @@ -308,7 +308,7 @@
                   QName name = unkElement.getElementType();
                   if(name.getNamespaceURI().equals(Constants.URI_WSDL12_SOAP) && 
                      name.getLocalPart().equals("binding")){
  -                    use = Use.ENCODED12;
  +                    use = Use.ENCODED;
                   }
               }
           }
  
  
  
  1.4       +1 -1      xml-axis/java/test/soap12/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/soap12/TestRPC.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestRPC.java      21 Jan 2003 17:01:14 -0000      1.3
  +++ TestRPC.java      12 Feb 2003 21:59:29 -0000      1.4
  @@ -45,7 +45,7 @@
           SOAPService service = new SOAPService(new RPCProvider());
           service.setOption("className", "test.soap12.Echo");
           service.setOption("allowedMethods", "*");
  -        service.setOption("use", Use.ENCODED12);
  +        service.setOption("use", Use.ENCODED);
   
           ServiceDesc desc = service.getInitializedServiceDesc(null);
           desc.setDefaultNamespace(method);
  
  
  
  1.7       +2 -4      
xml-axis/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java
  
  Index: WhiteMesaSoap12AddTestSvcTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WhiteMesaSoap12AddTestSvcTestCase.java    12 Feb 2003 19:01:32 -0000      1.6
  +++ WhiteMesaSoap12AddTestSvcTestCase.java    12 Feb 2003 21:59:29 -0000      1.7
  @@ -328,8 +328,7 @@
           Call call = new Call(DOC_INT_ENDPOINT);
           call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
           call.setOperationStyle(Style.WRAPPED);
  -        call.setOperationUse(Use.LITERAL);
  -        call.addParameter(new QName("", "inputString"),
  +        call.addParameter(new QName(TEST_NS, "inputString"),
                             Constants.XSD_STRING, ParameterMode.IN);
           call.setReturnType(Constants.XSD_STRING);
           
  @@ -348,8 +347,7 @@
           Call call = new Call(DOC_INT_UC_ENDPOINT);
           call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
           call.setOperationStyle(Style.WRAPPED);
  -        call.setOperationUse(Use.LITERAL);
  -        call.addParameter(new QName("", "inputString"),
  +        call.addParameter(new QName(TEST_NS, "inputString"),
                             Constants.XSD_STRING, ParameterMode.IN);
           call.setReturnType(Constants.XSD_STRING);
           
  
  
  


Reply via email to