Skip to main content

jaxws-maven-plugin wsimport fails due to schema descriptor error

4 replies [Last post]
billybacon
Offline
Joined: 2009-02-03
Points: 0

I've searched and troubleshooted for a week now, I can't find anything out there leading me to the solution to this issue. I'm assuming there is something wrong with the WSDL or XSD file which isn't cooperating with the jaxws-maven-plugin but I'm not entire sure. Some premlinary information:
Java 1.6 / Maven 2.2.1 / jaxws-maven-plugin 2.1
I'm successfully generating source with another wsdl with the same plugin configuration so I don't believe this is the issue, but here's my configuration in my pom.xml.
<code>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.midwesttapes.services.stub</packageName>
<wsdlDirectory>src/main/webapp/WEB-INF/wsdl</wsdlDirectory>
<verbose>true</verbose>
<xdebug>true</xdebug>
</configuration>
</plugin>
</code>
When I attempt to build my project, I get the following error (I've set verbose and xdebug equal to 'true' to get more output):
[INFO] jaxws:wsimport args: [-s, /Users/bbacon/Development/workspace/dillon/mwt/webservices/target/generated-sources/wsimport, -d, /Users/bbacon/Development/workspace/dillon/mwt/webservices/target/classes, -verbose, -p, com.midwesttapes.services.stub, -Xdebug, -Xnocompile, /Users/bbacon/Development/workspace/dillon/mwt/webservices/src/main/webapp/WEB-INF/wsdl/bookinfo.wsdl]
parsing WSDL...

[DEBUG] Authorization file "/Users/bbacon/.metro/auth" not found. If the WSDL access needs Basic Authentication, please provide authorization file with read access at /Users/bbacon/.metro/auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//<url-path>

com.sun.istack.SAXParseException2: Schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN in message part "Parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.
at com.sun.tools.ws.wscompile.ErrorReceiver.error(ErrorReceiver.java:82)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModelerBase.error(WSDLModelerBase.java:719)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.getJAXBType(WSDLModeler.java:1630)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.isUnwrappable(WSDLModeler.java:2043)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.processLiteralSOAPOperation(WSDLModeler.java:774)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.processSOAPOperation(WSDLModeler.java:704)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:472)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:251)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:221)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:133)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.wsImport(WsImportMojo.java:324)
at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.processLocalWsdlFiles(WsImportMojo.java:285)
at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.execute(WsImportMojo.java:239)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[ERROR] Schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN in message part "Parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.
line 34 of file:/Users/bbacon/Development/workspace/dillon/mwt/webservices/src/main/webapp/WEB-INF/wsdl/bookinfo.wsdl

WSDL file (I tried attaching as a file but it doesn't allow this file extension)
<code>
<wsdl:definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:meta="GetBookInfoByISBN"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:impl="GetBookInfoByISBN"
targetNamespace="GetBookInfoByISBN">
<!--
Somewhere a reference to "GetBookInfoByISBN" should be "http://www.dynix.com/schema/book" instead...
xmlns:impl="http://www.dynix.com/schema/book"
targetNamespace="http://www.dynix.com/schema/book"
-->
<import namespace="http://www.dynix.com/schema/meta" location="meta.xsd"/>

<xsd:annotation>
<xsd:documentation>
The Dynix Book Information Webservice
Authored by Byers Parsons

Aug 10, 2003 - version 1.1

Refactored for BWI compatibility: changed name, case, and order of message parts.

Feb 17, 2003 - version 1.0 - Initial release

This web service gets data (see meta.xsd) about a book by ISBN.
</xsd:documentation>
</xsd:annotation>

<wsdl:message name="GetBookInfoByISBNRequest">
<wsdl:part name="Parameters" element="meta:GetBookInfoByISBN" />
</wsdl:message>
<wsdl:message name="GetBookInfoByISBNResponse">
<wsdl:part name="Body" element="meta:GetBookInfoByISBNResponse"/>
</wsdl:message>

<wsdl:portType name="BookInfoPortType">
<wsdl:operation name="GetBookInfoByISBN">
<wsdl:input name="GetBookInfoByISBNRequest" message="impl:GetBookInfoByISBNRequest"/>
<wsdl:output name="GetBookInfoByISBNResponse" message="impl:GetBookInfoByISBNResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="BookInfoPortSoapBinding" type="impl:BookInfoPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetBookInfoByISBN">
<wsdlsoap:operation soapAction="GetBookInfoByISBN/GetBookInfoByISBN" style="document"/>
<wsdl:input>
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="BookInfoService">
<wsdl:port name="BookInfoPort" binding="impl:BookInfoPortSoapBinding">
<wsdlsoap:address location="http://@HOSTNAME@/services/BookInfoService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

</code>
XSD
<code>
<?xml version="1.0"?>
<xsd:schema targetNamespace="GetBookInfoByISBN"
xmlns:marc="http://www.dynix.com/MARC21/slim"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="GetBookInfoByISBN"
elementFormDefault="qualified" attributeFormDefault="qualified" version="1.0" xml:lang="en">

<xsd:annotation>
<xsd:documentation>
The Dynix XML Metadata Schema
Authored by Byers Parsons

Aug 10, 2003 - version 1.1

Refactored for BWI compatibility: changed case of element names, re-ordered elements,
and added wrapper elements. Added optional status for reply record type.

Feb 17, 2003 - version 1.0 - Initial release

This schema supports basic information exchange with optional MarcXML support.
</xsd:documentation>
</xsd:annotation>

<!-- Only required if use Marc XML
<xsd:import namespace="http://www.dynix.com/MARC21/slim" schemaLocation="marc.xsd"/>
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
-->

<xsd:element name="GetBookInfoByISBN" type="BookInfoByISBNType">
<xsd:annotation>
<xsd:documentation>The element wrapping request information</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:complexType name="BookInfoByISBNType">
<xsd:annotation>
<xsd:documentation>Type that defines book id and authentication information</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ISBN" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="CustomerAccount" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="CustomerSubAccount" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="LoginName" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="LoginPassword" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<xsd:element name="BookInfoElement" type="BookInfoType">
<xsd:annotation>
<xsd:documentation>The element wrapping the fixed simple metadata about a specific book</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:complexType name="BookInfoType">
<xsd:annotation>
<xsd:documentation>Type that defines the fixed metadata about a book</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="Title" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Author" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="ISBN" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Publisher" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="PublicationDate" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="PublicationPlace" type="xsd:string"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Edition" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="DiscountPrice" type="xsd:double"/>
<xsd:element minOccurs="0" maxOccurs="1" name="Availability" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="ListPrice" type="xsd:double"/>
<xsd:element minOccurs="1" maxOccurs="1" name="DiscountPercent" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>

<xsd:element name="BookInfoByISBNResponse" type="BookInfoResponseType">
<xsd:annotation>
<xsd:documentation>Reply with fixed metadata and MARC XML record about a book</xsd:documentation>
</xsd:annotation>
</xsd:element>

<!-- Addition for direct BWI compatibility (VB & .Net). BP -->
<xsd:element name="GetBookInfoByISBNResponse">
<xsd:annotation>
<xsd:documentation>Reply with fixed metadata about a book wrapped in sequence and element</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="GetBookInfoByISBNResult" type="BookInfoResponseType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:complexType name="BookInfoResponseType">
<xsd:annotation>
<xsd:documentation>Type that defines status, fixed metadata, and MARC XML returned about a book</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Status" type="xsd:string" minOccurs="0"/>
<xsd:element name="BookInfo" type="BookInfoType"/>
<!--<xsd:element name="Marc" type="marc:recordType" minOccurs="0"/>-->
<xsd:element name="Marc" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</code>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jungicz
Offline
Joined: 2004-08-17
Points: 0

Hi,

Maven plugin is not guilty here as it fails even on the command line..

billybacon wrote:

[ERROR] Schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN in message part "Parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {GetBookInfoByISBN}GetBookInfoByISBN is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.

line 34 of file:/Users/bbacon/Development/workspace/dillon/mwt/webservices/src/main/webapp/WEB-INF/wsdl/bookinfo.wsdl

this tells you what the problem is - GetBookInfoByISBN element from GetBookInfoByISBN namespace cannot be found, so there's something wrong with your wsdl and/or schema (actually with both of them...)

billybacon wrote:

<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"...
<import namespace="http://www.dynix.com/schema/meta" location="meta.xsd"/>
...

Is this really what you want? You're importing WSDL from meta.xsd (may not be exactly true but to make the answer shorter...)

I think you want to import datatypes from meta.xsd, right? This is the way:

<wsdl:definitions
...
<types>
<xsd:schema>
<xsd:import namespace="GetBookInfoByISBN" schemaLocation="meta.xsd"/>
</xsd:schema>
</types>
...

This is the first part of the problem. The second problem is that datatypes in your schema are defined in no namespace, this is what wsimport will tell you:

src-resolve.4.1: Error resolving component 'BookInfoType'. It was detected that 'BookInfoType' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/D:/_bug/ml/src/main/webapp/WEB-INF/wsdl/meta.xsd'. If 'BookInfoType' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'BookInfoType' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/D:/_bug/ml/src/main/webapp/WEB-INF/wsdl/meta.xsd'.
line 124 of file:/D:/_bug/ml/src/main/webapp/WEB-INF/wsdl/meta.xsd

src-resolve: Cannot resolve the name 'BookInfoType' to a(n) 'type definition' component.
line 124 of file:/D:/_bug/ml/src/main/webapp/WEB-INF/wsdl/meta.xsd

In order to fix this you have to define one more namespace in the schema, ie xmlns:x="GetBookInfoByISBN" and refer to the types from this schema using 'x' prefix, for example: <xsd:element name="GetBookInfoByISBN" type="x:BookInfoByISBNType">

HTH.

--lukas

billybacon
Offline
Joined: 2009-02-03
Points: 0

Lukas - Thanks so much for the reply, your first suggestion/change helped a great deal! It got me past the WSDL code generation and I'm no longer receiving that error. I tried adding your second suggestion, using the 'meta' prefix that is already in place, BUT my remaining problem is that the WSDL code generation is _not_ generating the GetBookInfoByISBN.java class and as a result, I'm getting 3 compilation errors in one of my classes that uses that type. Here are the classes that are being generated successfully have adding the xsd:import declaration as you suggested. For some reason it doesn't appear to be generating elements that have types.

generating code...

com/midwesttapes/services/stub/BookInfoByISBNType.java
com/midwesttapes/services/stub/BookInfoPortType.java
com/midwesttapes/services/stub/BookInfoResponseType.java
com/midwesttapes/services/stub/BookInfoService.java
com/midwesttapes/services/stub/BookInfoType.java
com/midwesttapes/services/stub/GetBookInfoByISBNResponse.java
com/midwesttapes/services/stub/ObjectFactory.java
com/midwesttapes/services/stub/package-info.java

Using the 'meta' prefix for all the types in the meta.xsd and changing the xmlns at the top of the meta.xsd produces the same results.

For example, I changed this xmlns="GetBookInfoByISBN" to xmlns:meta="GetBookInfoByISBN" with no luck, still not generating the GetBookInfoByISBN class.

Any ideas?

jungicz
Offline
Joined: 2004-08-17
Points: 0

what about changing current element definition to:

<xsd:element name="GetBookInfoByISBN" >
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="ISBN"
type="xsd:string" />
...
</xsd:sequence>
</xsd:complexType>
</xsd:element>

--lukas

billybacon
Offline
Joined: 2009-02-03
Points: 0

Thanks again for the reply Lukas!

This seems to resolve the issue, which I think is similar to your suggestion:

<xsd:element name="GetBookInfoByISBN">
<xsd:annotation>
<xsd:documentation>The element wrapping request information</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="GetBookInfoByISBN" type="BookInfoByISBNType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

Thanks so much for your help here!