[ 
http://issues.apache.org/jira/browse/AXIS-2386?page=comments#action_12423906 ] 
            
Christine Chen commented on AXIS-2386:
--------------------------------------

This problem started to manifest after I switched the style (-y) from RPC to 
WRAPPED when running java2wsdl (Axis 1.4) against my Interface/Impl classes.  
My tester classes contain a single method with 2 INOUT params of Holder types:

public void listContexts( ArrayOfStringHolder Contexts, ArrayOfDummyHolder 
Dummys);

The wsdl generated has the correct complex type definition for ArrayOfDummy, 
but instead of providing a definition for ArrayOfString, it just has string.

After debugging a bit, the problem seems to be with 
axis.description.JavaServiceDesc::getTypeQName(), the javaClass being passed in 
is "[Ljava.lang.String".  Because I used WRAPPED style, it will go to:

            typeQName = tm.getTypeQNameExact(javaClass); 

            if (typeQName == null && javaClass.isArray()) {
                typeQName = tm.getTypeQName(javaClass.getComponentType());
            } 

The first line returns null because "[Ljava.lang.String" is not in the 
typemappings (which I think do not contain any array types).  Realising the 
class is an array type,  it will try to look up the QName for the component 
type. which is string.  Thus getTypeQName() returns 'string' as the QName for 
my ArrayOfStringHolder type.

In the RPC style case, it will just call the following and return null.
if (style == Style.RPC) {
            typeQName = tm.getTypeQName(javaClass);
        }

Looks to me a paramDesc with null QName will prompt java2wsdl to generate a 
complex type as expected.

For my case, perhaps the fix can be put in 
axis.description.JavaServiceDesc::createOperationForMethod():
 Class heldClass = JavaUtils.getHolderValueType(type);
                System.out.println("heldClass: " + heldClass.getName());
                if (heldClass != null) {
                    paramDesc.setMode(ParameterDesc.INOUT);
                   QName qname = getTypeQName(heldClass); ....

if the class was a Holder type, call some overloaded class of getTypeQName() 
that does not look up the QName for the array's component type.

For now, I'm thinking of wrapping String inside a class, say MyString, and 
declare a holder with MyString[] to work around the problem until the bug is 
fixed. 

> Java2WSDL changes type double array into a single double.
> ---------------------------------------------------------
>
>                 Key: AXIS-2386
>                 URL: http://issues.apache.org/jira/browse/AXIS-2386
>             Project: Apache Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.2.1, 1.3
>         Environment: Linux 2.4.26, java version "1.5.0_04", Tomcat 5.5
>            Reporter: Eric Webster
>            Priority: Minor
>         Attachments: DataSet.wsdl, IncorrectDataSet.wsdl
>
>
> Java2WSDL changes type double array into a single double.
> This happens when you run Java2WSDL manually on the command line or when a 
> wsdl file is generated from a service_name?wsdl url.
> Currently to fix this I just manually edit the generated WSDL file and 
> distrobute that.
> The Java code originally came from a hand made WSDL file. WSDL2Java was used 
> to generate the Java code. The section that is affected by this problem is 
> the 'ValueVector' complexType which contains and element 'values' which is an 
> array of doubles. After converting to Java and then back to WSDL 'values' 
> becomes a single double. 
> Here is the original WSDL file.
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions 
>     targetNamespace="dataset.odin.cirg.washington.edu" 
>     xmlns:apachesoap="http://xml.apache.org/xml-soap"; 
>     xmlns:impl="dataset.odin.cirg.washington.edu" 
>     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
>     xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>   <wsdl:types>
>     <schema targetNamespace="dataset.odin.cirg.washington.edu" 
> xmlns="http://www.w3.org/2001/XMLSchema";>
>       <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>       
>       <complexType name="ArrayOf_xsd_double">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:double[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="ArrayOf_xsd_string">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       
>       <simpleType name="TypeEnum">
>       <restriction base="xsd:string">
>         <enumeration value="count"/>
>         <enumeration value="flag"/>
>         <enumeration value="score"/>
>         <enumeration value="blank"/>
>         <enumeration value="error"/>
>         <enumeration value="other"/>
>         <enumeration value="unknown"/>
>       </restriction>
>       </simpleType>
>       <simpleType name="IntervalUnitEnum">
>       <restriction base="xsd:string">
>         <enumeration value="second"/>
>         <enumeration value="week"/>
>         <enumeration value="month"/>
>         <enumeration value="year"/>
>       </restriction>
>       </simpleType>
>       <complexType name="Attribute">
>       <sequence>
>         <element name="name" type="xsd:string"/>
>         <element name="value" type="xsd:string" nillable="true"/>
>       </sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_Attribute">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" 
> wsdl:arrayType="impl:Attribute[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="ValueVector">
>       <sequence>
>         <element name="name" type="xsd:string" nillable="true"/>
>         <element name="type" type="impl:TypeEnum"/>
>         <element name="date" type="xsd:string"/>
>         <element name="interval" type="xsd:int"/>
>         <element name="intervalUnit" type="impl:IntervalUnitEnum"/>
>         <element name="attributes" type="impl:ArrayOf_impl_Attribute" 
> nillable="true"/>
>         <element name="values" type="impl:ArrayOf_xsd_double" 
> nillable="true"/>
>       </sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_ValueVector">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" 
> wsdl:arrayType="impl:ValueVector[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="DataSet">
>       <sequence>
>         <element name="name" type="xsd:string" nillable="true"/>
>         <element name="attributes" type="impl:ArrayOf_impl_Attribute" 
> nillable="true"/>
>         <element name="vectors" type="impl:ArrayOf_impl_ValueVector"/>
>       </sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_DataSet">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:DataSet[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="DataSetArray">
>       <sequence>
>         <element name="array" type="impl:ArrayOf_impl_DataSet"/>
>       </sequence>
>       </complexType>
>       <complexType name="SurvCol">
>       <sequence>
>         <element name="name" type="xsd:string"/>
>         <element name="values" type="impl:ArrayOf_xsd_string"/>
>         <element name="attributes" type="impl:ArrayOf_impl_Attribute" 
> nillable="true"/>
>       </sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_SurvCol">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:SurvCol[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="SurvDataSet">
>       <sequence>
>         <element name="name" type="xsd:string" nillable="true"/>
>         <element name="attributes" type="impl:ArrayOf_impl_Attribute" 
> nillable="true"/>
>         <element name="vectors" type="impl:ArrayOf_impl_SurvCol"/>
>       </sequence>
>       </complexType>
>       <complexType name="ArrayOf_impl_SurvDataSet">
>       <complexContent>
>         <restriction base="soapenc:Array">
>           <attribute ref="soapenc:arrayType" 
> wsdl:arrayType="impl:SurvDataSet[]"/>
>         </restriction>
>       </complexContent>
>       </complexType>
>       <complexType name="SurvDataSetArray">
>       <sequence>
>         <element name="array" type="impl:ArrayOf_impl_SurvDataSet"/>
>       </sequence>
>       </complexType>
>     </schema>
>   </wsdl:types>
> </wsdl:definitions>
> Here is what 'ValueVector' turns into after running WSDL2Java (which creates 
> correct java code) and then Java2WSDL.
>    <complexType name="ValueVector">
>     <sequence>
>      <element name="name" nillable="true" type="xsd:string"/>
>      <element name="type" type="tns2:TypeEnum"/>
>      <element name="date" type="xsd:string"/>
>      <element name="interval" type="xsd:int"/>
>      <element name="intervalUnit" type="tns2:IntervalUnitEnum"/>
>      <element name="attributes" nillable="true" 
> type="impl:ArrayOf_tns1_Attribute"/>
>      <element name="values" nillable="true" type="xsd:double"/>
>     </sequence>
>    </complexType>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to