Hi all,

I have problems with bindings generated by the jibx2wsdl tool from my
Java code. Actually I don't think this is a jibx2wsdl issue, -- I
suppose it just uses the common JiBX Binding Generator, but I had no
chance to compare so far. Also, sorry if an issue of this kind was
already discussed here, still I couldn't find the exact discussion.

So, I am using a pure interface approach to my complex types and service
API.

Complex types interfaces:

============= IPerson ==============
package reg.api;
public interface IPerson {
        String getName();
        void setName(String name);
        ILocation getLocation();
        void setLocation(ILocation location);
}
====================================

============= ILocation ============
package reg.api;
public interface ILocation {
        String getCity();
        void setCity(String city);
}
====================================

Complex types implementations:

============== PersonImpl ==========
package reg.impl;
import reg.api.ILocation;
import reg.api.IPerson;
public class PersonImpl implements IPerson {
.........
}
====================================

============ LocationImpl ==============
package reg.impl;
import reg.api.ILocation;
public class LocationImpl implements ILocation {
......................
}
====================================

And my service definition:
============== IService ===============
package reg.serv;
import reg.api.IPerson;
public interface IService {
        IPerson getPerson(String name);
        void updatePerson(String name, IPerson person);
}
====================================

Then I apply the jibx2wsdl to my IService interface in order to generate
my bindings and WSDL. Without specifying (via -x option) my
implementations PersonImpl and LocationImpl I am getting a
"factory-method needed for abstract type" error, so I do use -x for my
implementations and getting the following bindings:

============ regapiBinding.xml ===========
<binding xmlns:tns="http://reg.api"; force-classes="true"
        add-constructors="true">
        <namespace uri="http://reg.api"; default="elements" prefix="ns2"
/>
        <mapping abstract="true" type-name="tns:IPerson"
                class="reg.api.IPerson">
                <structure map-as="tns:ILocation"
get-method="getLocation"
                        set-method="setLocation" usage="optional"
name="location" />
                <value style="element" name="name" get-method="getName"
                        set-method="setName" usage="optional" />
        </mapping>
        <mapping abstract="true" type-name="tns:ILocation"
                class="reg.api.ILocation">
                <value style="element" name="city" get-method="getCity"
                        set-method="setCity" usage="optional" />
        </mapping>
</binding>
====================================

============== regimplBinding.xml ==========
<binding xmlns:tns="http://reg.impl"; xmlns:ns1="http://reg.api";
        force-classes="true" add-constructors="true">
        <namespace uri="http://reg.impl"; default="elements" prefix="ns1"
/>
        <mapping class="reg.impl.PersonImpl" name="personImpl">
                <structure map-as="ns1:ILocation"
get-method="getLocation"
                        set-method="setLocation" usage="optional"
name="location" />
                <value style="element" name="name" get-method="getName"
                        set-method="setName" usage="optional" />
        </mapping>
        <mapping class="reg.impl.LocationImpl" name="locationImpl">
                <value style="element" name="city" get-method="getCity"
                        set-method="setCity" usage="optional" />
        </mapping>
</binding>
====================================

The second one obviously does not imply an expected proper inheritance
and mostly duplicates the first binding. In any case, I continue with
the binding compiler. It works ok for these bindings, but a simple
marshalling test fails with a "java.lang.ClassFormatError: Method <init>
in class reg/api/ILocation has illegal modifiers: 0x1001". Decompiler is
showing me a default public constructor added to the ILocation.class as
a result of the binding compilation (I suppose, this is the reason of
the ClassFormatError). Further generation of server code with the
WSDL2Java results in code containing compile errors because of attempts
to invoke a constructor on my interface.

Actually, I have 2 questions:
1) What the bindings should look like for my code based on interfaces? I
need to somehow specify default implementation classes for the
unmarshalling case, don't I? I am quite new to JiBX and failed with
manual playing with the bindings.
2) Is there any correct way I can get proper bindings with the generator
tools for this case?

Any help on this will be very much appreciated! Thank you in advance!


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