That was exactly the clue I needed.  Thank you.  I was able to
determine what was happening.  You're a life saver.

Thanks!

Ryan

2009/8/19 Ralf Joachim <[email protected]>:
> Hi Ryan,
>
> to my knowledge Castor usually calls:
>
> orderDetailResponse.getRxs().add(prescription);
>
> for every unmarshalled Prescription tag. Would that make any sense for
> the problem you have?
>
> You should be able to change the default behaviour be specifying get and
> set methods in mappimg. For the set method attribute you have to specify
> a method that adds a Prescription object to the collection.
>
> http://castor.codehaus.org/reference/html/XML%20data%20binding.html#xml.mapping.mappingfile.field
>
> Regards
> Ralf
>
>
> Ryan Sutter schrieb:
>> As a follow up to this, I have done extensive debugging and have
>> determined that when attempting to unmarshal the XML, Castor
>> successfully creates each prescription object in the unmarshaled
>> collection but never makes the call to "setPrescriptions(List value)"
>> to set the collection.  Judging by this, I think it's safe to say that
>> Castor is successfully parsing the input XML and correctly mapping it
>> but for some reason is refusing to take the final step of calling the
>> setter for the collection during unmarshaling.  Does this help
>> pinpoint this?  Is this potentially a bug in Castor?
>>
>> Thanks,
>>
>> Ryan
>>
>> On Mon, Aug 17, 2009 at 4:08 PM, Ryan Sutter<[email protected]> wrote:
>>
>>> I am confused.
>>>
>>> I have an object called OrderDetailResponse with the following Castor 
>>> mapping:
>>>
>>>        <class
>>>                
>>> name="com.mycompany.service.iface.rxexpress.OrderDetailResponse">
>>>                <map-to xml="OrderDetailResponse" />
>>>                <field name="code" type="java.lang.String">
>>>                        <bind-xml name="messageType" node="element" />
>>>                </field>
>>>                <field name="orderNumber" type="java.lang.String">
>>>                        <bind-xml name="orderNumber" node="element" />
>>>                </field>
>>>                <field name="returnCode" type="int">
>>>                        <bind-xml name="returnCode" node="element" />
>>>                </field>
>>>                <field name="returnMessage" type="java.lang.String">
>>>                        <bind-xml name="returnMessage" node="element" />
>>>                </field>
>>>                <field name="rxs" collection="arraylist"
>>>                        type="com. 
>>> mycompany.service.iface.rxexpress.Prescription" container="false">
>>>                        <bind-xml name="prescriptions" />
>>>                </field>
>>>
>>>        </class>
>>>
>>> It has an arraylist collection of an object called Prescription with
>>> it's own mapping so:
>>>
>>>        <class name="com.mycompany.service.iface.rxexpress.Prescription">
>>>                <map-to xml="prescription" />
>>>                <field name="birthDate" type="java.util.Date">
>>>                        <bind-xml name="birthDate" node="element" />
>>>                </field>
>>>                <field name="firstName" type="java.lang.String">
>>>                        <bind-xml name="firstName" node="element" />
>>>                </field>
>>>                <field name="lastName" type="java.lang.String">
>>>                        <bind-xml name="lastName" node="element" />
>>>                </field>
>>>                <field name="memberNumber" type="java.lang.String">
>>>                        <bind-xml name="memberNumber" node="element" />
>>>                </field>
>>>                <field name="orderNumber" type="java.lang.String">
>>>                        <bind-xml name="orderNumber" node="element" />
>>>                </field>
>>>                <field name="phoneNumberAsString" type="java.lang.String">
>>>                        <bind-xml name="phoneNumber" node="element" />
>>>                </field>
>>>                <field name="physicianName" type="java.lang.String">
>>>                        <bind-xml name="physicianName" node="element" />
>>>                </field>
>>>                <field name="rxNumber" type="java.lang.String">
>>>                        <bind-xml name="rxNumber" node="element" />
>>>                </field>
>>>                <field name="shippedDate" type="java.util.Date">
>>>                        <bind-xml name="shippedDate" node="element" />
>>>                </field>
>>>                <field name="zipCode" type="java.lang.String">
>>>                        <bind-xml name="zipCode" node="element" />
>>>                </field>
>>>                <field name="dosage" type="java.lang.String">
>>>                        <bind-xml name="dosage" node="element" />
>>>                </field>
>>>                <field name="drugName" type="java.lang.String">
>>>                        <bind-xml name="drugName" node="element" />
>>>                </field>
>>>                <field name="expirationDate" type="java.util.Date">
>>>                        <bind-xml name="expirationDate" node="element" />
>>>                </field>
>>>                <field name="filledDate" type="java.util.Date">
>>>                        <bind-xml name="filledDate" node="element" />
>>>                </field>
>>>                <field name="physicianPhoneNumberAsString" 
>>> type="java.lang.String">
>>>                        <bind-xml name="physicianPhoneNumber" node="element" 
>>> />
>>>                </field>
>>>                <field name="quantity" type="java.lang.String">
>>>                        <bind-xml name="quantity" node="element" />
>>>                </field>
>>>                <field name="refillDate" type="java.util.Date">
>>>                        <bind-xml name="refillDate" node="element" />
>>>                </field>
>>>                <field name="refillsRemaining" type="int">
>>>                        <bind-xml name="refillsRemaining" node="element" />
>>>                </field>
>>>        </class>
>>>
>>> When I create an OrderDetailResponse and marshal it, I get exactly
>>> what I expect:
>>>
>>> <?xml version="1.0"
>>> encoding="UTF-8"?><RxRefill><OrderDetailResponse><orderNumber>12345678</orderNumber><returnCode>99</returnCode><returnMessage>Return
>>> message.</returnMessage><prescriptions><prescription><birthDate>2009-08-17T15:59:06.588-05:00</birthDate><firstName>Tasty</firstName><lastName>Rerun</lastName><memberNumber>12345678</memberNumber><orderNumber>12345</orderNumber><phoneNumber>6516516511</phoneNumber><physicianName>Paco
>>> Gonzales</physicianName><rxNumber>123456</rxNumber><shippedDate>2009-08-17T15:59:06.588-05:00</shippedDate><zipCode>55124</zipCode><dosage>100
>>> Mg</dosage><drugName>Druggy
>>> Drug</drugName><expirationDate>2009-08-17T15:59:06.588-05:00</expirationDate><filledDate>2009-08-17T15:59:06.588-05:00</filledDate><physicianPhoneNumber>9529529552</physicianPhoneNumber><quantity>1</quantity><refillDate>2009-08-17T15:59:06.588-05:00</refillDate><refillsRemaining>10</refillsRemaining></prescription></prescriptions></OrderDetailResponse></RxRefill>
>>>
>>> However, when I take this output XML and attempt to unmarshal it back
>>> into an object, the setPrescriptions(List prescriptions) isn't even
>>> being called (the other setters on the object are) and I end up with
>>> this:
>>>
>>> <?xml version="1.0"
>>> encoding="UTF-8"?><RxRefill><OrderDetailResponse><orderNumber>12345678</orderNumber><returnCode>99</returnCode><returnMessage>Return
>>> message.</returnMessage><prescriptions/></OrderDetailResponse></RxRefill>
>>>
>>> What gives?  Why can Castor marshal the objects but not unmarshal it's
>>> own output?  Why are no exceptions being thrown or errors being given
>>> if something is going wrong?  Any suggestions on anything I might look
>>> at?
>>>
>>> Thanks in advance,
>>>
>>> Ryan
>>>
> --
>
> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
> Ralf Joachim
> Raiffeisenstraße 11
> 72127 Kusterdingen
> Germany
>
> Tel.   +49 7071 3690 52
> Mobil: +49 173 9630135
> Fax    +49 7071 3690 98
>
> Internet: www.syscon.eu
> E-Mail: [email protected]
>
> Sitz der Gesellschaft: D-72127 Kusterdingen
> Registereintrag: Amtsgericht Stuttgart, HRB 382295
> Geschäftsleitung: Jens Joachim, Ralf Joachim
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



-- 
http://ryansutter.net

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to