Is it possible to have a collection mapped to a typed array?  I could not find
an example, nor do my attempts work.

Details: I have XML messages like this one:

   <?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
     <soapenv:Body>
       <ns:getContainersResponse xmlns:ns="http://...peering.service";>
         <ns:getContainersReturn>
           <ns:AContainees>
             <ns:aContainee>
               <ns:id>4711</ns:id>
             </ns:aContainee>
             <ns:aContainee>
               <ns:id>4712</ns:id>
             </ns:aContainee>
             <ns:aContainee>
               <ns:id>4713</ns:id>
             </ns:aContainee>
             <ns:aContainee>
               <ns:id>4714</ns:id>
             </ns:aContainee>
             <ns:aContainee>
               <ns:id>4715</ns:id>
             </ns:aContainee>
           </ns:AContainees>
           <ns:name>name-of-container</ns:name>
         </ns:getContainersReturn>
       </ns:getContainersResponse>
     </soapenv:Body>
   </soapenv:Envelope>

And POJOs structured like that:

   public class AContainer{
       ...
       private String name;
       public String getName(){...}
       public void setName(String name){...}

       private AContainee[] aContainees;
       public AContainee[] getAContainees(){...}
       public void setAContainees(AContainee[] aContainees){...}
   }

   public class AContainee{
       ...
       private int id;
       public int getId(){...}
       public void setId(int id){...}

       private AContainer aContainer;
       public AContainer getAContainer(){...}
       public void setAContainer(AContainer aContainer){...}
   }

I'm trying this binding.xml:

   <?xml version="1.0" encoding="UTF-8"?>
   <binding force-classes="true" 
            xmlns:tns="http://...peering.service"; 
            value-style="element">
       <namespace uri="http://...peering.service"; default="elements"/>

       <mapping abstract="true" 
                type-name="tns:AContainee" 
                class="AContainee" ordered="false">
           <value name="id" field="id" usage="optional"/>
           <value name="aContainer" field="aContainer" usage="optional"/>
       </mapping>

       <mapping abstract="true" 
                type-name="tns:AContainer" 
                class="AContainer" ordered="false">
           <value name="name" field="name" usage="optional"/>
           <collection field="aContainees" item-type="AContainee[]"/>
       </mapping>
   </binding>

The JiBX binding compiler runs fine.  Axis2's WSDL2Java runs fine, too.  But
when I run the WSDL2Java-generated test client, it complains:

   org.apache.axis2.AxisFault: No unmarshaller for element 
"{http://..peering.service}AContainees";
   ...

I then tried to deploy the TypedArrayMapper by adding this to binding.xml:

    <mapping abstract="true" 
             type-name="tns:AContainees"
             class="AContainee[]"
             marshaller="org.jibx.extras.TypedArrayMapper"
             unmarshaller="org.jibx.extras.TypedArrayMapper"/>
    
But it gives me the same runtime error.

I'm obviously missing a mapping definition, but I'm clueless which one.

Any help is greatly appreciated.
-Max

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to