tomj        02/02/12 10:33:57

  Modified:    java/src/org/apache/axis/wsdl/toJava SymbolTable.java
                        JavaFaultWriter.java
               java/src/org/apache/axis/utils resources.properties
               java/test/wsdl/clash clash.wsdl
  Log:
  Prevent stub generation in the case of use=literal where the message part is 
specified
  using the type="foo" attribute.  Axis will not (yet)generate the correct XML in this 
case.
  This was encountered in an example of rpc style, literal encoding
  (which JAX-RPC does not require support for).
  
  Example which will not be supported:
  <part name="mypart" type="ns:myType">
  <binding ..>
    ....
    <soap:body use=literal>
  
  Revision  Changes    Path
  1.29      +23 -6     xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SymbolTable.java  8 Feb 2002 23:18:54 -0000       1.28
  +++ SymbolTable.java  12 Feb 2002 18:33:56 -0000      1.29
  @@ -834,9 +834,11 @@
   
           boolean literalInput = false;
           boolean literalOutput = false;
  +        String bindingName = "unknown";
           if (bindingEntry != null) {
               literalInput = (bindingEntry.getInputBodyType(operation) == 
BindingEntry.USE_LITERAL);
               literalOutput = (bindingEntry.getOutputBodyType(operation) == 
BindingEntry.USE_LITERAL);
  +            bindingName = bindingEntry.getBinding().getQName().toString();
           }
           
           // Collect all the input parameters
  @@ -844,7 +846,7 @@
           if (input != null) {
               partStrings(inputs,
                       input.getMessage().getOrderedParts(null), 
  -                    literalInput);
  +                    literalInput, operation.getName(), bindingName);
           }
   
           // Collect all the output parameters
  @@ -852,7 +854,7 @@
           if (output != null) {
               partStrings(outputs,
                       output.getMessage().getOrderedParts(null), 
  -                    literalOutput);
  +                    literalOutput, operation.getName(), bindingName);
           }
   
           if (parameterOrder != null) {
  @@ -979,7 +981,8 @@
        * This method returns a vector containing the Java types (even indices) and
        * names (odd indices) of the parts.
        */
  -    protected void partStrings(Vector v, Collection parts, boolean literal) {
  +    protected void partStrings(Vector v, Collection parts, boolean literal, String 
opName, String bindingName) 
  +            throws IOException {
           Iterator i = parts.iterator();
   
           while (i.hasNext()) {
  @@ -993,6 +996,9 @@
                       v.add(getType(typeName));
                       v.add(part.getName());
                   } else if (elementName != null) {
  +                    // Just an FYI: The WSDL spec says that for use=encoded
  +                    // that parts reference an abstract type using the type attr
  +                    // but we do the right thing here, so let it go.
                       v.add(getElement(elementName));
                       v.add(part.getName());
                   }
  @@ -1003,9 +1009,20 @@
               // if we can, we use these as the types
               Node node = null;
               Element e;
  -            if (typeName != null) {
  -                node = getTypeEntry(typeName, false).getNode();
  -            } else if (elementName != null) {
  +            if (typeName != null && elementName == null) {
  +                // Since we can't (yet?) make the Axis engine generate the right
  +                // XML for literal parts that specify the type attribute,
  +                // abort processing with an error if we encounter this case
  +                //
  +                // node = getTypeEntry(typeName, false).getNode();
  +                throw new IOException(
  +                        JavaUtils.getMessage("literalTypePart00", 
  +                                             new String[] {part.getName(), 
  +                                                           opName,  
  +                                                           bindingName}));
  +            }
  +            
  +            if (elementName != null) {
                   node = getTypeEntry(elementName, true).getNode();
                   // Check if this element is of the form:
                   //    <element name="foo" type="tns:foo_type"/> 
  
  
  
  1.5       +5 -1      
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java
  
  Index: JavaFaultWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JavaFaultWriter.java      16 Jan 2002 19:14:02 -0000      1.4
  +++ JavaFaultWriter.java      12 Feb 2002 18:33:56 -0000      1.5
  @@ -90,7 +90,11 @@
   
           // XXX  Have to get use information (literal/encoded) for fault from
           // XXX  BindingEntry, which we don't have the QName for
  -        symbolTable.partStrings(params, fault.getMessage().getOrderedParts(null), 
false);
  +        symbolTable.partStrings(params, 
  +                                fault.getMessage().getOrderedParts(null), 
  +                                false, 
  +                                fault.getName(), 
  +                                "unknown");
   
           // Write data members of the exception and getter methods for them
           for (int i = 0; i < params.size(); i += 2) {
  
  
  
  1.53      +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.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- resources.properties      12 Feb 2002 12:51:53 -0000      1.52
  +++ resources.properties      12 Feb 2002 18:33:56 -0000      1.53
  @@ -638,3 +638,5 @@
   badProp00=Bad property.  The value for {0} should be of type {1}, but it is of type 
{2}.
   badProp01=Bad property.  {0} should be {1}; but it is {2}.
   badProp02=Cannot set {0} property when {1} property is not {2}.
  +
  +literalTypePart00=Error: Message part {0} of operation or fault {1} is specified as 
a type and the soap:body use of binding "{2}" is literal.  This WSDL is not currently 
supported.
  \ No newline at end of file
  
  
  
  1.2       +30 -4     xml-axis/java/test/wsdl/clash/clash.wsdl
  
  Index: clash.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/clash/clash.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- clash.wsdl        2 Feb 2002 15:23:06 -0000       1.1
  +++ clash.wsdl        12 Feb 2002 18:33:56 -0000      1.2
  @@ -19,6 +19,13 @@
             <xsd:element name="sharedName" type="xsd:int"/>
           </xsd:all>
         </xsd:complexType>
  +      <xsd:element name="myElement">
  +        <xsd:complexType>
  +          <all>
  +            <element name="sharedName" type="xsd:int"/>
  +          </all>
  +        </xsd:complexType>
  +      </xsd:element>
       </xsd:schema>
     </types>
   
  @@ -28,6 +35,9 @@
     <message name="sharedName">
       <part name="sharedName" type="tns:sharedName"/>
     </message>
  +  <message name="literalMessage">
  +    <part name="literalPart" element="tns:myElement"/>
  +  </message>
   
     <!-- port type declns -->
     <portType name="sharedName">
  @@ -46,6 +56,22 @@
       </operation>
   -->
     </portType>
  +  <portType name="literalPort">
  +    <operation name="sharedName">
  +      <input name="sharedName" message="tns:empty"/>
  +      <output name="sharedName" message="tns:literalMessage"/>
  +    </operation>
  +<!-- a bug in WSDL4J doesn't allow overloaded operations 
  +    <operation name="sharedName">
  +      <input name="sharedName" message="tns:literalMessage"/>
  +      <output name="empty" message="tns:empty"/>
  +    </operation>
  +    <operation name="sharedName">
  +      <input name="empty" message="tns:empty"/>
  +      <output name="sharedName" message="tns:literalMessage"/>
  +    </operation>
  +-->
  +  </portType>
   
     <!-- binding declns -->
     <binding name="nonSharedName" type="tns:sharedName">
  @@ -80,7 +106,7 @@
   -->
     </binding>
   
  -  <binding name="sharedName" type="tns:sharedName">
  +  <binding name="sharedName" type="tns:literalPort">
       <soap:binding
           style="rpc"
           transport="http://schemas.xmlsoap.org/soap/http"/>
  @@ -98,15 +124,15 @@
           <soap:body use="literal"/>
         </input>
         <output name="empty">
  -        <soap:body use="encoded"/>
  +        <soap:body use="literal"/>
         </output>
       </operation>
       <operation name="sharedName">
         <input name="empty">
  -        <soap:body use="encoded"/>
  +        <soap:body use="literal"/>
         </input>
         <output name="sharedName">
  -        <soap:body use="encoded"/>
  +        <soap:body use="literal"/>
         </output>
       </operation>
   -->
  
  
  


Reply via email to