Hi Joanna,

It looks like you're getting a somewhat unintended side-effect of the 
abstract mapping in your second binding, with the collection as a 
separate mapping. Abstract mappings aren't really intended to be used 
directly as collection item types, and I should probably have a 
validation check to catch it when this is done. The intended ways to do 
what you want are (1) make the Arrival mapping concrete, with a name 
specified on the <mapping>, in which case the collection can reference 
it directly as an item-type, or (2) keep the Arrival mapping abstract, 
and add a child element to the collection:

  <collection field="...">
    <structure name="arrival" type="... Arrival"/>
  </collection>

If either of these approaches doesn't work for you I'd appreciate a Jira 
bug report with the specifics. Thanks,

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Joanna Muench wrote:
> I'm running into problems adding a collection to my schema in a wsdl. It 
> works 
> fine if the binding is in-line:
>
>    <mapping type-name="xsd:eventType" abstract="true" 
> class="edu.iris.ws.phasepick.Event">
>      <value name="localId" field="id"/>
>      <value name="location" field="location"/>
>      <value name="prefOrigin" field="prefOrigin"/>
>      <value name="author" field="author"/>
>      <collection field="arrivals">
>        <structure name="arrival" type="edu.iris.ws.phasepick.Arrival">
>          <value name="station" field="station"/>
>          <value name="distance" field="distance"/>
>          <value name="phase" field="phase"/>
>          <value name="azimuth" field="azimuth"/>
>          <value name="author" field="author"/>
>          <value name="arrivalTime" field="arrivalTime"/>
>        </structure>
>      </collection>
>    </mapping>
>
> generates the expected XML:
>
> <inputEvent>
>    <localid>2</localid>
>    <location>Oregon Coast</location>
>    <prefOrigin>12</prefOrigin>
>    <author>UW Geophysics</author>
>    <arrival>
>      <station>SUW</station>
>      <distance>402.7</distance>
>      <phase>P</phase>
>      <azimuth>19.4</azimuth>
>      <author>K Creager</author>
>      <arrivalTime>2004-01-10T21:22:53Z</arrivalTime>
>    <arrival>
>    <arrival>
>      <station>GBS</station>
>      <distance>1052.8</distance>
>     ... etc.
>
> But when I try to remove the collection as a separate mapping:
>
> <mapping type-name="xsd:eventType" abstract="true" 
> class="edu.iris.ws.phasepick.Event">
>    <value name="localId" field="id"/>
>    <value name="location" field="location"/>
>    <value name="prefOrigin" field="prefOrigin"/>
>    <value name="author" field="author"/>
>    <collection field="arrivals" name="arrival" 
> item-type="edu.iris.ws.phasepick.Arrival"/>
> </mapping>
>
>    <mapping name="xsd:arrivalType" class="edu.iris.ws.phasepick.Arrival">
>      <value name="station" field="station"/>
>      <value name="distance" field="distance"/>
>      <value name="phase" field="phase"/>
>      <value name="azimuth" field="azimuth"/>
>      <value name="author" field="author"/>
>      <value name="arrivalTime" field="arrivalTime"/>
>    </mapping>
>
> I get:
>
> <inputEvent>
>    <localid>2</localid>
>    <location>Oregon Coast</location>
>    <prefOrigin>12</prefOrigin>
>    <author>UW Geophysics</author>
>    <arrival>
>      <station>SUW</station>
>      <distance>402.7</distance>
>      <phase>P</phase>
>      <azimuth>19.4</azimuth>
>      <author>K Creager</author>
>      <arrivalTime>2004-01-10T21:22:53Z</arrivalTime>
>    <arrival>
>    <station>GBS</station>
>    <distance>1052.8</distance>
>    <phase>P</phase>
>    <azimuth>29.1</azimuth>
>    <author>K Creager</author>
>    <arrivalTime>2004-01-10T21:23:53Z</arrivalTime>
>    &gt;
> </inputEvent>
>
> This looks like a bug, but is it because I'm not writing the mapping the 
> right 
> way and should be using a named mapping or abstract (neither of which has 
> worked 
> for me in this instance)?
>
> Thanks, Joanna
>
>
>
> -------------------------------------------------------------------------
> 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
>
>   

-------------------------------------------------------------------------
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