Hi Casjen,
You don't say what goes wrong, but I suspect the problem lies in using
an abstract mapping recursively. This rarely makes sense, since normally
you'd want to use an element name to hold the data.
Assuming you really want an XML structure along these lines:
<CustomerPO>
<customerNumber>12345</customerNumber>
<friend>
<customerNumber>12344</customerNumber>
</friend>
</CustomerPO>
you can handle this by adding a name="friend" to the <structure
field="friendOf".../>. You probably also want to make this optional,
since otherwise you'd end up with either an infinite list of nested
<friend>s or a NullPointerException. :-)
You can also get a structure like this, if you prefer, with only a
single layer of friend reference and a more compact form:
<CustomerPO>
<customerNumber>12345</customerNumber>
<friendNumber>12344</friendNumber>
</CustomerPO>
To get this, change the <structure> to:
<structure field="friendOf">
<structure field="customerNumber">
<value name="friendNumber" field="value"/>
</structure>
</structure>
Here again, you may want to make the field optional.
Hope that helps,
- 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
[EMAIL PROTECTED] wrote:
>
> Hi there,
>
> altough I have searched the Archieve I am not able to fix the
> following problem by myself.
>
> I have a class CustomerPO like listed below.
> This class holds a reference to an object of the same class in the
> property friendOf.
> I need to use this class in an unwrapped WebService with axi 2 and
> jibx as binding framework.
> Can I do unmarshalling and marshalling with jibx for this class?
> How has my binding.xml to look like?
>
> //my binding, that does not work:
>
> <binding xmlns:tns="http://po.simpleservice/xsd"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" force-classes="true">
> <namespace uri="http://po.simpleservice/xsd" default="elements"/>
> <mapping class="simpleservice.po.RequestPO" abstract="true"
> type-name="tns:RequestPO">
> <structure field="customerNumberPO">
> <structure field="customerNumber">
> <value name="customerNumber" field="value"/>
> </structure>
> </structure>
> </mapping>
> <mapping class="simpleservice.po.CustomerPO" abstract="true"
> type-name="tns:CustomerPO">
> <structure field="customerNumber">
> <value name="customerNumber" field="value"/>
> </structure>
> <structure field="friendOf" map-as="tns:CustomerPO"/>
> </mapping>
> <mapping class="simpleservice.po.ResponsePO" abstract="true"
> type-name="tns:ResponsePO">
> <structure field="customerPO"/>
> </mapping>
> </binding>
>
>
> //Class CustomerPO:
>
> public class CustomerPO {
>
> private FDTInteger customerNumber;
> private CustomerPO friendOf;
>
> public CustomerPO() {
> super();
> }
>
> public CustomerPO(FDTInteger pvCustomerNumber, CustomerPO pvFriendOf) {
> super();
> this.customerNumber = pvCustomerNumber;
> this.friendOf = pvFriendOf;
> }
>
> public CustomerPO getFriendOf() {
> return this.friendOf;
> }
>
> public void setFriendOf(CustomerPO pvFriendOf) {
> this.friendOf = pvFriendOf;
> }
> public FDTInteger getCustomerNumber() {
> return this.customerNumber;
> }
> public void setCustomerNumber(FDTInteger pvCustomerNumber) {
> this.customerNumber = pvCustomerNumber;
> }
> }
>
> king regards
>
> Casjen
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users