You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by david2 <Da...@l-3comcept.com> on 2007/06/19 19:52:07 UTC
WSDL2Java Exception with nested binding & schema files
I was running into a different WSDL2Java CodeGenerationException while
working with nested binding files and a WSDL that uses nested schemas.
Our WSDL is pretty simple and imports an external schema, but that schema is
fairly complex and includes of other schemas. Also, our binding files are
pretty much tied to their respective schemas, so they are nested as well.
To illustrate a simpler example of what we are trying to do, I modified
Dennis Sosnoski's "jibx-library" example
(http://www.sosnoski.com/jibx-wiki/space/axis2-jibx/example), eliminating
most functionality, adding a Subject object as an attribute to the Book
object, and added nested schema & binding files for BookInformation &
SubjectInformation. I successfully tested the binding files by generating a
binding jar with org.jibx.binding.ant.CompileTask and using it to
unmarshalling XML into a Book object (which contains a Subject object) &
remartialling it back into XML ("ant build" & "ant run" with code in
simpleLibrary-bindingOnly.zip). However, when I run ant in the example
("ant" with code in simpleLibrary.zip), WSDL2Java fails during the
generate-client target with the following exception (tested with both JiBX
1.1.3 & 1.1.5):
generate-client:
[echo] Running WSDL2Java task
[mkdir] Created dir:
C:\development\examples\jibx-simpleLibrary\client\gen
[java] Retrieving schema at 'book.xsd', relative to
'file:/C:/development/examples/jibx-library/./'.
[java] Retrieving schema at 'subject.xsd', relative to
'file:/C:/development/examples/jibx-library/book.xsd'.
[java] Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.NullPointerException
[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
[java] Caused by: java.lang.NullPointerException
[java] at
org.apache.axis2.jibx.CodeGenerationUtility.collectTopLevelComponents(CodeGenerationUtility.java:957)
[java] at
org.apache.axis2.jibx.CodeGenerationUtility.collectTopLevelComponents(CodeGenerationUtility.java:966)
[java] at
org.apache.axis2.jibx.CodeGenerationUtility.engage(CodeGenerationUtility.java:301)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at
org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage(JiBXExtension.java:74)
[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:177)
[java] ... 2 more
The binding files, schemas, wsdl, and updated source are attached. Please
let me know if you see anything that may be causing the WSDL2Java exception.
http://www.nabble.com/file/p11199623/simpleLibrary.ZIP simpleLibrary.ZIP
http://www.nabble.com/file/p11199623/simpleLibrary-bindingOnly.ZIP
simpleLibrary-bindingOnly.ZIP
--
View this message in context: http://www.nabble.com/WSDL2Java-Exception-with-nested-binding---schema-files-tf3947855.html#a11199623
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: WSDL2Java Exception with nested binding & schema files
Posted by david2 <Da...@l-3comcept.com>.
I was finally able to get past the WSDL2Java exception and managed to get a
web service running that utilized nested objects, nested schema files and
nested binding files. However, now I find that I can build a web service
request using a parent object/type or its children, but never a parent AND
one of its children.
Apparently the binding for a parameter must be set to abstract="true" for
unwrapping to work properly. However, if another message accepts a child of
that parameter, the child must also be declared abstract, which breaks the
build for the parent.
The following files (click to download) illustrate this issue:
1. http://www.nabble.com/file/p11221735/jibx-nested-1-parentOnly.ZIP
jibx-nested-1-parentOnly.ZIP - contains a full build of a web service that
assigns a Book to a Course. Both of these parameters are "parents", each
containing a object, namely a Subject (unzip 1, then "ant" to build and "ant
run" to execute the client).
2. http://www.nabble.com/file/p11221735/jibx-nested-2-childOnly.ZIP
jibx-nested-2-childOnly.ZIP - contains deltas to the ZIP file #1 to create
a web service that eliminate the message from #1 above, and provides a
different message that allows a new Subject to be added (unzip #1 AND #2,
then "ant" to build and "ant run" to execute the client).
3.
http://www.nabble.com/file/p11221735/jibx-nested-3-parentAndChild-broken.ZIP
jibx-nested-3-parentAndChild-broken.ZIP - contains deltas to the ZIP file
#1 to create a web service that provides both of these messages.
Unfortunately, the web service will not build, since the parent bindings
(Book & Course) and the child binding (Subject) cannot both be declared
abstract (unzip #1 AND #3, then "ant" to generate the exception).
Is there any way to get messages with both "parent" and "child" object
parameters to build and work? Also, there are some incompatible differences
between binding that work for Axis2/WSDL2Java and those that work directly
with JiBX examples. Why is this so?
-David
=========================================================
Exception generated:
generate-client:
[echo] Running WSDL2Java task
[mkdir] Created dir:
C:\backups\20070620-1426-jibx-nested-baseline\temp\client\gen
[java] Retrieving schema at 'book.xsd', relative to
'file:/C:/backups/20070620-1426-jibx-nested-baseline/temp/./'.
[java] Retrieving schema at 'subject.xsd', relative to
'file:/C:/backups/20070620-1426-jibx-nested-baseline/temp/book.xsd'.
[java] Retrieving schema at 'course.xsd', relative to
'file:/C:/backups/20070620-1426-jibx-nested-baseline/temp/./'.
[java] Retrieving schema at 'subject.xsd', relative to
'file:/C:/backups/20070620-1426-jibx-nested-baseline/temp/course.xsd'.
[java] Retrieving schema at 'subject.xsd', relative to
'file:/C:/backups/20070620-1426-jibx-nested-baseline/temp/./'.
[java] Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: Cannot unwrap element
{http://ws.sosnoski.com/library/wsdl}addSubject: no abstract mapping
definition found for type
{http://ws.sosnoski.com/library/types}SubjectInformation (used by element
{http://ws.sosnoski.com/library/wsdl}subject)
[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:256)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
[java] Caused by: java.lang.RuntimeException: Cannot unwrap element
{http://ws.sosnoski.com/library/wsdl}addSubject: no abstract mapping
definition found for type
{http://ws.sosnoski.com/library/types}SubjectInformation (used by element
{http://ws.sosnoski.com/library/wsdl}subject)
[java] at
org.apache.axis2.jibx.CodeGenerationUtility.unwrapMessage(CodeGenerationUtility.java:818)
[java] at
org.apache.axis2.jibx.CodeGenerationUtility.engage(CodeGenerationUtility.java:382)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at
org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage(JiBXExtension.java:74)
[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:209)
[java] ... 2 more
BUILD FAILED
--
View this message in context: http://www.nabble.com/WSDL2Java-Exception-with-nested-binding---schema-files-tf3947855.html#a11221735
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org