I have been trying to learn how to use JiBX for one of my projects and I
have run into quite a few errors when using jibx2wsdl according to the
examples that I was hoping someone would help me solve. So my apologies
for the generic message title but I thought it would be better than
sending a lot of small emails.
First off, say I have the following source files
src/com/bug/Test.java:
package com.bug;
public class Test{public static Parent getChildAsParent() {return new
Child();}}
src/com/bug/Parent.java:
package com.bug;
public class Parent{public int x;public Parent(){this.x=0;}}
src/com/bug/Child.java:
package com.bug;
public class Child extends Parent{public int y;public
Child(){this.y=0;}}
I don't think it is necessary to setup a build.xml for this project
since simply running javac src/com/bug/*.java will suffice.
I would first like to note that unless the source files are part of the
package com.bug, this will not work. It seems that the files must be
part of a package at least 2 levels deep. Though I can deal with this,
to me it seems like a bug. Especially since, if the source files are
not nested at least 2 levels deep, the generated error message is not
useful at all for solving the problem (it is a NullPointerException with
no explanation).
Then, if I run the command, java -cp $JIBX_HOME/lib/jibx-tools.jar
org.jibx.ws.wsdl.tools.Jibx2Wsdl -p src -t output -v com.bug.Test
I get a wsdl file but no binding.xml or *.xsd file. Furthermore, the
wsdl file is all but empty, containing no reference to any of the
methods exposed by the class Test (the <wsdl:portType> tag has no
children).
Here is the generated WSDL file:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http
://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://bug.com/Test"
targetNamespa
ce="http://bug.com/Test">
<wsdl:types/>
<wsdl:portType name="TestPortType"/>
<wsdl:binding name="TestBinding" type="tns:TestPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="docume
nt"/>
</wsdl:binding>
<wsdl:service name="Test">
<wsdl:port name="TestPort" binding="tns:TestBinding">
<soap:address
location="http://localhost:8080/axis2/services/Test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This also seems like a bug to me and I was hoping someone would have
some advice for how to fix it. I would at least like the WSDL file to
contain a reference to some of the methods exposed on Test (as this is,
after all, the entire reason for generating the WSDL file). I was also
expecting a binding.xml file and a schema file to be generated.
Since no bindings were being generated, I tried to include the classes
manually with the -x switch. So I ran the following command:
java -cp $JIBX_HOME/lib/jibx-tools.jar org.jibx.ws.wsdl.tools.Jibx2Wsdl
-p src -x com.bug.Child -x com.bug.Parent -x com.bug.Test -t output -v
com.bug.Test
However, this generates the error: "Error: 'extends' mapping not usable
as schema extension base; on mapping element at (line 6, col 72, in
binding.xml)"
After running this command, I find a binding.xml file in the output
directory but no wsdl or xsd files. It seems that I am not allowed to
use -x with Parent and Child at the same time.
This also seems like a bug to me since I checked the generated
binding.xml file and it looks just like the one described here:
http://jibx.sourceforge.net/binding/tutorial/binding-mappings.html#inherit
If these are bugs, I was hoping someone would be able to help me come up
with a work-around. Otherwise, could someone please explain to me what
I am doing wrong?
Thanks,
John Edmonds
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users