Issue Details (XML | Word | Printable)

Key: JAX_WS-900
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: ramapulavarthi
Reporter: donatasc
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jax-ws

wsimport does not accept -B-catalog option

Created: 21/Oct/10 11:20 AM   Updated: 14/Feb/11 12:25 PM   Resolved: 22/Nov/10 08:52 PM
Component/s: wsimport
Affects Version/s: 2.1.8, current
Fix Version/s: 2.2.2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive bug.zip (13 kB) 27/Oct/10 11:44 PM - donatasc

Environment:

Operating System: All
Platform: All


Issuezilla Id: 900
Tags:
Participants: donatasc, jitu, ramapulavarthi and ramapulavarthi


 Description  « Hide

Though xjc supports command line option: -catalog <file>, there is no way to
pass this option through wsimport parameters.
For example: specifying this for wsimport maven plugin:

<xjcArgs>
<xjcArg>-catalog jax-ws-catalog.xml</xjcArg>
</xjcArgs>

produces error message:

No such JAXB option: -catalog jax-ws-catalog.xml



jitu added a comment - 22/Oct/10 11:34 AM

assigning this to Rama


ramapulavarthi added a comment - 26/Oct/10 11:13 PM

wsimport accepts -catalog option, just pass the catalog via wsimport option and the same would be used
internally by xjc.


ramapulavarthi added a comment - 26/Oct/10 11:24 PM

When wsimport catalog is not specified, xjc catalog option (if specified via xjc arg)should not be
overridden.


donatasc added a comment - 26/Oct/10 11:41 PM

I doubt whether wsimport actually passes its catalog to xjc. The example below
shows that I supply catalog to wsimport, but still get warnings complaining that
xsd files are not accessible via network (they really are not accessible,
therefore I supply catalog):

[INFO] Processing:
d:\dev\proj\eds3\eds3-ExternalTaxPayerWS-client\src\wsdl\ExternalTaxPayerService.wsdl
[INFO] jaxws:wsimport args: [-s,
d:\dev\proj\eds3\eds3-ExternalTaxPayerWS-client\target\generated-sources\jaxws-wsimport
, -d, d:\dev\proj\eds3\eds3-ExternalTaxPayerWS-client\target\classes, -verbose,
-p, lt.mitsoft.vmi.eds3.externaltaxpayer
wsclient.generated, -catalog,
d:\dev\proj\eds3\eds3-ExternalTaxPayerWS-client\src\jax-ws-catalog.xml,
-wsdllocation, /ws
dl/ExternalTaxPayerService.wsdl, -extension, -Xnocompile,
-B-XautoNameResolution, d:\dev\proj\eds3\eds3-ExternalTaxPayer
WS-client\src\wsdl\ExternalTaxPayerService.wsdl]
parsing WSDL...

---------------------------
[WARNING] schema_reference.4: Failed to read schema document
'http://vpc-eds-wgw.eds.asw.lt/ASW.EDS.ExternalPortalServic
es/TaxPayers/ExternalTaxPayerService.svc?xsd=xsd0', because 1) could not find
the document; 2) the document could not be
read; 3) the root element of the document is not <xsd:schema>.
line 2 of
file:/D:/dev/proj/eds3/eds3-ExternalTaxPayerWS-client/src/wsdl/ExternalTaxPayerService.wsdl#types?schema1

[WARNING] schema_reference.4: Failed to read schema document
'http://vpc-eds-wgw.eds.asw.lt/ASW.EDS.ExternalPortalServic
es/TaxPayers/ExternalTaxPayerService.svc?xsd=xsd1', because 1) could not find
the document; 2) the document could not be
read; 3) the root element of the document is not <xsd:schema>.
line 2 of
file:/D:/dev/proj/eds3/eds3-ExternalTaxPayerWS-client/src/wsdl/ExternalTaxPayerService.wsdl#types?schema1
-------------------------------

this is my catalog:

--------------------
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<system
systemId="http://vpc-eds-wgw.eds.asw.lt/ASW.EDS.ExternalPortalServices/TaxPayers/ExternalTaxPayerService.svc?wsdl"
uri="wsdl/ExternalTaxPayerService.wsdl"/>
<system
systemId="http://vpc-eds-wgw.eds.asw.lt/ASW.EDS.ExternalPortalServices/TaxPayers/ExternalTaxPayerService.svc?xsd=xsd0"
uri="wsdl/wrappers.xsd"/>
<system
systemId="http://vpc-eds-wgw.eds.asw.lt/ASW.EDS.ExternalPortalServices/TaxPayers/ExternalTaxPayerService.svc?xsd=xsd1"
uri="wsdl/Serialization.xsd"/>
...
</catalog>
--------------------------

and all schema files are really there in wsdl folder.

It seems that finally xjc pics the xsd files from wsdl folder, as the java code
gets generated. But why those warnings, and on each warning I get some 5-10
seconds delay till network responds that remote location unreachable.
If catalog is supplied, and the resource is in catalog, neither wsimport nor xjc
should even try to go to internet.


ramapulavarthi added a comment - 27/Oct/10 08:28 AM

Its odd, If it fails to use resolver, it should have failed as the wsdl/schema are not accessible on the remote
location. Can you set the logging to verbose by setting the CatalogManager.properties.
As per the current impl, wsimport should set an EntityResolver when wsimport receives a catalog option.
Can you attach a test case to reproduce the issue.


donatasc added a comment - 27/Oct/10 11:44 PM

Created an attachment (id=282)
Maven project demonstrating ignored catalog behaviour


donatasc added a comment - 27/Oct/10 11:47 PM

I have created an attachment containing maven project.
"mvn compile" completes successfully, but on each xsd file it tries to reach
some network location and stops for 5-10 seconds. Then it prints warning and
continues. It seems that it falls back finally to pick xsd files from local file
system (as directed by catalog file), but these 5-10 second delays on each xsd
are very annoying.


ramapulavarthi added a comment - 11/Nov/10 04:45 PM - edited

Catalog is infact passed and used by XJC while parsing the schema for building the model.
These warnings are because of an issue in XJC where it uses catalog to resolve imported schemas while
building the forest, but during schema correctness check it does not set the
entity resolver. In com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.java#230,
EntityResolver is not set on the SchemaFactory. This results in to unnecessary
warning thrown during schema resolution.

Filed issue on jaxb:https://jaxb.dev.java.net/issues/show_bug.cgi?id=795

Workaround: One could set com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.noCorrectnessCheck=true so that XJC does not do schema correctness check.


ramapulavarthi added a comment - 12/Nov/10 12:54 PM

Though passing catalog using wsimport args works, JAX-WS always sets a entity resolver. This results in supressing the catalog passed to jaxb using xjcargs.


ramapulavarthi added a comment - 22/Nov/10 08:52 PM

Fixed wsimport to not set the entity resolver when its null, to not override XJC's entity resolver.