You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tcs <ta...@hotmail.com> on 2007/12/13 22:48:14 UTC

array - difference between JAXB and Aegis Binding

Hi, 

I wrote a simple web service with two methods, one that would take an array
and one that would return an array.

    public String[] getAbc() {
    	String[] strs = new String[3];
    	strs[0] = "a";
       	strs[1] = "b";
       	strs[2] = "c";
        return strs;
    }
    
    public String setAbc(String[] args) {
    	return "done";
    }

I noticed that with JAXB binding, the WSDL created does not have the wrapper
'ArrayOf...' element present.

<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="http://server.hw.demo/"
xmlns:tns="http://server.hw.demo/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <xsd:element name="setAbc" type="tns:setAbc"/>

 <xsd:complexType name="setAbc">
   <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="arg0"
type="xsd:string"/>
   </xsd:sequence>
  </xsd:complexType>

 <xsd:element name="setAbcResponse" type="tns:setAbcResponse"/>

 <xsd:complexType name="setAbcResponse">
   <xsd:sequence>
    <xsd:element minOccurs="0" name="return" type="xsd:string"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:element name="getAbc" type="tns:getAbc"/>

 <xsd:complexType name="getAbc">
    <xsd:sequence/>
 </xsd:complexType>

 <xsd:element name="getAbcResponse" type="tns:getAbcResponse"/>
 <xsd:complexType name="getAbcResponse">
   <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="return"
type="xsd:string"/>
   </xsd:sequence>
 </xsd:complexType>

</xsd:schema>


However with Aegis binding, the wrapper 'ArrayOf...' elements are present. 
<xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://server.hw.demo/">
    <xsd:complexType name="ArrayOfString">
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="string"
nillable="true" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="setAbc" type="tns:setAbc"/>
    <xsd:complexType name="setAbc">

        <xsd:sequence>
            <xsd:element name="arg0" nillable="true"
type="tns:ArrayOfString"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="setAbcResponse" type="tns:setAbcResponse"/>
    <xsd:complexType name="setAbcResponse">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="return" type="xsd:string"/>
        </xsd:sequence>

    </xsd:complexType>
    <xsd:element name="getAbc" type="tns:getAbc"/>
    <xsd:complexType name="getAbc">
        <xsd:sequence/>
    </xsd:complexType>
    <xsd:element name="getAbcResponse" type="tns:getAbcResponse"/>
    <xsd:complexType name="getAbcResponse">
        <xsd:sequence>
            <xsd:element name="return" nillable="true"
type="tns:ArrayOfString"/>

        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

I'd like to use Aegis binding. But would like my WSDL to not have the
wrapper 'ArrayOf...' elements.  Is that possible?

thanks,

Just as an fyi.. this issue was discussed in this thread:
http://www.nabble.com/JAX-WS-Array-Support-tt8483460.html#a8483460




-- 
View this message in context: http://www.nabble.com/array---difference-between-JAXB-and-Aegis-Binding-tp14325476p14325476.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: array - difference between JAXB and Aegis Binding

Posted by Daniel Kulp <dk...@apache.org>.
Nope.   Not right now.   The aegis databinging is very "type" oriented in 
that it generates a "type" for each field.   It doesn't try to collapse 
them down into elements with maxOccurs.   I looked into it a bit when 
fixing https://issues.apache.org/jira/browse/CXF-1116, but it didn't 
look easy so I just stuck with the ArrayOf stuff.

Dan


On Thursday 13 December 2007, tcs wrote:
> Hi,
>
> I wrote a simple web service with two methods, one that would take an
> array and one that would return an array.
>
>     public String[] getAbc() {
>     	String[] strs = new String[3];
>     	strs[0] = "a";
>        	strs[1] = "b";
>        	strs[2] = "c";
>         return strs;
>     }
>
>     public String setAbc(String[] args) {
>     	return "done";
>     }
>
> I noticed that with JAXB binding, the WSDL created does not have the
> wrapper 'ArrayOf...' element present.
>
> <xsd:schema attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> targetNamespace="http://server.hw.demo/"
> xmlns:tns="http://server.hw.demo/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:element name="setAbc" type="tns:setAbc"/>
>
>  <xsd:complexType name="setAbc">
>    <xsd:sequence>
>     <xsd:element maxOccurs="unbounded" minOccurs="0" name="arg0"
> type="xsd:string"/>
>    </xsd:sequence>
>   </xsd:complexType>
>
>  <xsd:element name="setAbcResponse" type="tns:setAbcResponse"/>
>
>  <xsd:complexType name="setAbcResponse">
>    <xsd:sequence>
>     <xsd:element minOccurs="0" name="return" type="xsd:string"/>
>   </xsd:sequence>
>  </xsd:complexType>
>
>  <xsd:element name="getAbc" type="tns:getAbc"/>
>
>  <xsd:complexType name="getAbc">
>     <xsd:sequence/>
>  </xsd:complexType>
>
>  <xsd:element name="getAbcResponse" type="tns:getAbcResponse"/>
>  <xsd:complexType name="getAbcResponse">
>    <xsd:sequence>
>     <xsd:element maxOccurs="unbounded" minOccurs="0" name="return"
> type="xsd:string"/>
>    </xsd:sequence>
>  </xsd:complexType>
>
> </xsd:schema>
>
>
> However with Aegis binding, the wrapper 'ArrayOf...' elements are
> present. <xsd:schema attributeFormDefault="qualified"
> elementFormDefault="qualified"
> targetNamespace="http://server.hw.demo/">
>     <xsd:complexType name="ArrayOfString">
>         <xsd:sequence>
>             <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="string" nillable="true" type="xsd:string"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:element name="setAbc" type="tns:setAbc"/>
>     <xsd:complexType name="setAbc">
>
>         <xsd:sequence>
>             <xsd:element name="arg0" nillable="true"
> type="tns:ArrayOfString"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:element name="setAbcResponse" type="tns:setAbcResponse"/>
>     <xsd:complexType name="setAbcResponse">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="return"
> type="xsd:string"/> </xsd:sequence>
>
>     </xsd:complexType>
>     <xsd:element name="getAbc" type="tns:getAbc"/>
>     <xsd:complexType name="getAbc">
>         <xsd:sequence/>
>     </xsd:complexType>
>     <xsd:element name="getAbcResponse" type="tns:getAbcResponse"/>
>     <xsd:complexType name="getAbcResponse">
>         <xsd:sequence>
>             <xsd:element name="return" nillable="true"
> type="tns:ArrayOfString"/>
>
>         </xsd:sequence>
>     </xsd:complexType>
> </xsd:schema>
>
> I'd like to use Aegis binding. But would like my WSDL to not have the
> wrapper 'ArrayOf...' elements.  Is that possible?
>
> thanks,
>
> Just as an fyi.. this issue was discussed in this thread:
> http://www.nabble.com/JAX-WS-Array-Support-tt8483460.html#a8483460



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog