Skip to main content

[wsimport] xsd:import not importing xsd file in a jar in classpath

6 replies [Last post]
vijjj
Offline
Joined: 2006-08-22
Points: 0

The WSDL file I am using imports a xsd file. The xsd file is in a jar file, which is available in the classpath.

Here the problem is that wsimport is taking the folder which contains the WSDL file as the context of the xsd file path.

Let's say the schema file is in a jar and has package com.test.schema

And the WSDL file is in ws-client/src/main/wsdl

wsimport is expecting the xsd file at ws-client/src/main/wsdl/com/test/schema/test.xsd

Any idea why this happens?...is there a limitation that xsd files are not imported from a jar file?

BTW, I am using latest SNAPSHOT jars.

Vijesh

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vivekp
Offline
Joined: 2003-06-10
Points: 0

It doesn't. wsimport does not work off imports from a jar file. So your imported schema should be relative to your WSDL location.

thanks,

-vivek.

vijjj
Offline
Joined: 2006-08-22
Points: 0

Thanks for the reply.

Will it be supported in future releases?....
If it is not there, modularization through xsd can't be achieved (in a more broader sense).

Vijesh

kohsuke
Offline
Joined: 2003-06-09
Points: 0

To be more precise --- wsimport uses JRE to parse URL and fetch the resources, so it can use any URL scheme that JRE understands, including jar:// protocol.

And I believe we do all the relative URL resolutions correctly, so if you invoke wsimport like:
[code]$ wsimport jar://my/a.jar!/path/to/foo.wsdl[/code], then it should be able to find all referenced XSDs in the WSDL today.

vijjj
Offline
Joined: 2006-08-22
Points: 0

Thanks kohsuke..

I think there is a small misunderstanding.
The wsdl file is there in the source path but xsd it imports is in a jar file in the classpath.

In this case will it work?

kohsuke
Offline
Joined: 2003-06-09
Points: 0

I don't understand what you mean by "in the source path". Also, whether something is in classpath or not is irrelevant. The point is whether it's available in a place where it's accessible via some kind of URL.

For example, if you try to refer a schema file in jar:// URL from a WSDL in file:// URL, then the only way to refer to it is by specifying the absolute jar:// URL.

vijjj
Offline
Joined: 2006-08-22
Points: 0

Thanks kohsuke,

I understood. Unfortunately this (jar protocol url) can't be applied in our case.

We may have to go with inline schema.