Hello.

I know this subject has already been discussed many times. I've been
searching for similar information, but it seems that all the reported
problems or questions only apply to rpc style services with soap arrays...
If it's not the case, sincerly sorry...

First, is it legal, according to WS-I, to return arrays of custom complex
types in document/literal style services ?

If yes, it seems the java2wsdl fails when generating the mappings for the
return element. The generated complex type is the unbounded element that
represents the array, but the complex type itself is not described.

Here is my example...

A bean class named CharacterCount has two members : a string and an integer.

An operation named analyse takes a string argument and returns an array of
CharacterCount :
public CharacterCount[] analyse(String string).

The ant script generates the wsdl using the following target :
        <target name="wsdl" depends="compile">
                <mkdir dir="./wsdl" />
                <property name="my.namespace" value="http://ws.moon.net/j2me05"; 
/>
                <java2wsdl output="./wsdl/j2me05ws.wsdl"
                           className="net.moon.me.five.ws.StringTool"
                           namespace="${my.namespace}"
                           porttypename="StringUtility"
                           serviceportname="StringUtilityPort"
                           serviceelementname="J2ME05"
                           style="document"
                           use="literal"
                           location="http://ws.moon.net/j2me05";>
                        <classpath>
                                <pathelement 
location="${my.services.compile-directory}" />
                                <path refid="my.axis.classpath" />
                        </classpath>
                        <complextype 
classname="net.moon.me.five.ws.StringStructure"
                                     namespace="${my.namespace}" />
                        <complextype 
classname="net.moon.me.five.ws.CharacterCount"
                                     namespace="${my.namespace}" />
                </java2wsdl>
        </target>
Note that the CharacterCount mapping is included...

The resulting wsdl file, where the complex type detailled description is
missing :

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws.moon.net/j2me05";
xmlns:impl="http://ws.moon.net/j2me05";
xmlns:intf="http://ws.moon.net/j2me05";
xmlns:apachesoap="http://xml.apache.org/xml-soap";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
<!--WSDL created by Apache Axis version: 1.2RC2
Built on Jan 28, 2005 (07:08:29 CET)-->
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://ws.moon.net/j2me05"; elementFormDefault="qualified">
   <element name="in0" type="xsd:string"/>
   <element name="reverseReturn" type="xsd:string"/>
   <complexType name="StringStructure">
    <sequence>
     <element name="count" type="xsd:int"/>
     <element name="string" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
   <element name="in1" type="impl:StringStructure"/>
   <element name="repeatReturn" type="xsd:string"/>
   <element name="in2" type="xsd:string"/>
   <complexType name="CharacterCount">
    <sequence>
     <element name="item" type="impl:CharacterCount" minOccurs="0"
maxOccurs="unbounded"/>
    </sequence>
   </complexType>
   <element name="analyseReturn" maxOccurs="unbounded"
type="impl:CharacterCount"/>
  </schema>
 </wsdl:types>

   <wsdl:message name="analyseRequest">

      <wsdl:part name="in0" element="impl:in2"/>

   </wsdl:message>

   <wsdl:message name="reverseRequest">

      <wsdl:part name="in0" element="impl:in0"/>

   </wsdl:message>

   <wsdl:message name="repeatRequest">

      <wsdl:part name="in0" element="impl:in1"/>

   </wsdl:message>

   <wsdl:message name="repeatResponse">

      <wsdl:part name="repeatReturn" element="impl:repeatReturn"/>

   </wsdl:message>

   <wsdl:message name="analyseResponse">

      <wsdl:part name="analyseReturn" element="impl:analyseReturn"/>

   </wsdl:message>

   <wsdl:message name="reverseResponse">

      <wsdl:part name="reverseReturn" element="impl:reverseReturn"/>

   </wsdl:message>

   <wsdl:portType name="StringUtility">

      <wsdl:operation name="reverse" parameterOrder="in0">

         <wsdl:input name="reverseRequest" message="impl:reverseRequest"/>

         <wsdl:output name="reverseResponse"
message="impl:reverseResponse"/>

      </wsdl:operation>

      <wsdl:operation name="repeat" parameterOrder="in0">

         <wsdl:input name="repeatRequest" message="impl:repeatRequest"/>

         <wsdl:output name="repeatResponse" message="impl:repeatResponse"/>

      </wsdl:operation>

      <wsdl:operation name="analyse" parameterOrder="in0">

         <wsdl:input name="analyseRequest" message="impl:analyseRequest"/>

         <wsdl:output name="analyseResponse"
message="impl:analyseResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="StringUtilityPortSoapBinding"
type="impl:StringUtility">

      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="reverse">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="reverseRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="reverseResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="repeat">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="repeatRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="repeatResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="analyse">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="analyseRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="analyseResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="J2ME05">

      <wsdl:port name="StringUtilityPort"
binding="impl:StringUtilityPortSoapBinding">

         <wsdlsoap:address location="http://ws.moon.net/j2me05"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

Did i miss something ?

Thanks for your help.

--
Ephemeris Lappis

Reply via email to