Sorry, in the email below I meant that I ran the java2wsdl utility.

On 6/29/06, Ben Reif <[EMAIL PROTECTED]> wrote:
Hey everyone,
 
I have two questions regarding generating schema with custom serializers. I'm using Axis 1.3 and I have some complex type objects that I want to expose in a Web Service. These objects aren't pure Java Beans so I had to write my own custom serializer and deserializer. These objects have getters and setters that deal with Lists of other complex type objects. In the writeSchema() method of my serializer I add an element to handle the getters/setters as arrays. When I run wsdl2java the schema in the WSDL comes out like this:
 
<schema elementFormDefault="qualified" targetNamespace=" http://my.class.package.name " xmlns="http://www.w3.org/2001/XMLSchema ">
    <complexType name="MyClass1">
                <sequence>
                    <element maxOccurs="1" minOccurs="0" name="myClass2s" nillable="true" type="tns2:ArrayOfMyClass2"/>
                </sequence>
    </complexType>
</schema>
 
I have tns2:ArrayOfMyClass2 defined farther down in the types section of the WSDL and it's in a different namespace then MyClass1. When I validate the WSDL it says that it's invalid because it's missing an <xsd:import namespace= http://my.class2.package.name/> from the above <schema> definition. My question is how can I add this import from the writeSchema() method in my serializer? The org.apache.wsdl.fromJava.Types class doesn't give you access to the WSDL document as a whole, or even the current <schema> element that's being written. Does anyone know of a way to do this?
 
 
My second question is that my service has methods that take in object arrays. So in my WSDD file I have <arrayMappings> defined and the schema in my WSDL I have wrapped array types like this:
 
<complexType name="ArrayOfMyClass">
    <sequence>
        <element maxOccurs="unbounded" minOccurs="0" name="MyClass" type="tns1:MyClass"/>
    </sequence>
</complexType>
 
The problem is that when I run wsdl2java the operation definitions in the default namespace <schema> section of the <wsdl:types> come out like:
 
<element name="myOperation">
    <complexType>
        <sequence>
            <element maxOccurs="unbounded" name="ArrayOfMyClass" type="tns1:MyClass"/>
        </sequence>
    </complexType>
</element>
 
This is incorrect because the maxOccurs should be 1, not unbounded, since it's a wrapped array type. It doesn't seem like the org.apache.wsdl.fromJava.Types has any methods to write out a wrapped array definition and it doesn't give you access to change this. Does anyone know how this can be done?
 
If anyone knows how to accomplish either of these thanks in advance,
 
Ben

Reply via email to