Hi.

Just looking for a little help when implementing this method.  Basically I
seem to be getting something other than what I expected in the WSDL - and in
the wrong location.

I have the method implemented as follows (see target WSD entry in comments):
============================================================================
========
        public Element writeSchema(Class javaType, Types types) throws 
Exception {
                Element complexType = types.createElement("complexType");
                Element sequence;
                Element element;

                /*      Target WSDL entry:
                        <complexType name="Customer">
                                <sequence>
                                        <element name="number" type="xsd:long"/>
                                        <element name="name" type="xsd:string"/>
                                        <element name="address" 
type="xsd:string"/>
                                </sequence>
                        </complexType>
                 */

                complexType.setAttribute("name", "Customer");
                sequence = types.createElement("sequence");
                complexType.appendChild(sequence);

                // Add the fields
                element = types.createElement(FIELD_NUMBER, "xsd:long", false, 
false,
sequence.getOwnerDocument());
                sequence.appendChild(element);
                element = types.createElement(FIELD_NAME, "xsd:string", false, 
false,
sequence.getOwnerDocument());
                sequence.appendChild(element);
                element = types.createElement(FIELD_ADDRESS, "xsd:string", 
false, false,
sequence.getOwnerDocument());
                sequence.appendChild(element);

                return complexType;
        }
============================================================================
========

The following is what's being output in the WSDL:
============================================================================
========
                        <complexType name="local">
                                <sequence>
                                        <element name="number" type="xsd:long"/>
                                        <element name="name" type="xsd:string"/>
                                        <element name="address" 
type="xsd:string"/>
                                </sequence>
                        </complexType>
============================================================================
========

Note <complexType name="local"> instead of <complexType name="Customer">.
Anyone any idea what I'm doing wrong here?

Using apache Axis v1.2.1.

Also, a related question....

How do I get writeSchema to output the above in the the appropriate <schema
targetNamespace="..."> section within the resulting WSDL?

Regards,

Tom.

Reply via email to