You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by "Graham Turrell (JIRA)" <ji...@apache.org> on 2006/09/12 11:25:24 UTC

[jira] Commented: (WODEN-14) Use XML Catalog To Improve Performance and Enable Offline Work

    [ http://issues.apache.org/jira/browse/WODEN-14?page=comments#action_12434100 ] 
            
Graham Turrell commented on WODEN-14:
-------------------------------------

Here is detail on the patch - and at the end how to run the sample:

This patch includes a framework for allowing resolution of any URI found in the source document(s). The framework allows for any conformant URI resolver implementation (ie implement the URIResolver interface) to be "plugged-in" at runtime.  A simple default resolver implementation is provided (SimpleURIResolver).
The framework has been incorporated into both the DOM and the OM parsers.

Packages:
Two new packages - org.apache.woden.resolver (API : framework classes, interfaces and concrete implementations) and org.apache.woden.internal.resolver (resolver helper classes).

org.apache.woden.resolver contains:

•	URIResolver interface
•	SimpleURIResolver
•	XMLCatalogURIResolver

org.apache.woden.internal.resolver contains:

•	SchemaResolverAdapter

Changes to existing classes for the Framework:

The URI resolver is used to resolve document URLs in the following places in a target WSDL 2 document:

1) <wsdl:description> Physical document URLs in "xsi:schemaLocation" attribute value.
2) <wsdl:import> and <wsdl:include> "location" attribute values;
3) <xsd:schema>  : <xsd:import> and <xsd:include> "schemaLocation" attribute values.


Writing a new resolver:

Write a class that implements org.apache.woden.resolver.URIResolver.
The method java.net.URI resolveURI(java.net.URI uri)  should return a resolved URI based on the argument uri, or null if no mapping supplied for uri.

Specifying default resolver (org.apache.woden.resolver.default="class spec")

The default URI resolver is initially set to the SimpleURIResolver. This means that this resolver will be used if not overridden programmatically. However it is possible to change the default resolver to some other, via the .apache.woden.resolver.default property. This can be specified either :

(1) by the jvm command line option (-D),for example:
-Dorg.apache.woden.resolver.default=com.myplace.mypackage.resolver.MyURIResolver
or
(2) as an equivalent entry in JAVAHOME\lib\wsdl.properties, for example:
org.apache.woden.resolver.default=com.myplace.mypackage.resolver.MyURIResolver

Associating a (non-default) URI resolver programmatically:

Instantiate a URIResolver object and register it with the WSDLReader prior to involving WSDLReader.readWSDL(). For example:

factory = new OMWSDLFactory(); // or DOMWSDLFactory() if desired			
WSDLReader reader = factory.newWSDLReader();
reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);	
reader.setURIResolver(new MyURIResolver()); // the one additional line of code needed.

Configuring the Simple Resolver (specifying the simple resolver mappings file)
This can be specified in the same ways as for the default URI Resolver as described above, namely:

(1) by the jvm command line option (-D),for example:
-Dorg.apache.woden.resolver.simpleresolver.catalog=c:\simpleresolver.catalog
or
(2) as an equivalent entry in JAVAHOME\lib\wsdl.properties, for example:
org.apache.woden.resolver.simpleresolver.catalog=c:\simpleresolver.catalog

Where the right hand side is the physcial location of the catalog file to be used my SimpleURIResolver . 

Contents of the Simple Resolver mapping file
This is a text file comprising of a one line entry for each document URL found in the target WSDLs that requires mapping to a different physical location that that stated in the document. The actual location is also a URL and may be on the local filesystem or over the net.

......{talk about escape sequences and example lines, and the local-xsd set}


Running the supplied SimpleURIResolver test

Setup:

1)	download the simpleresolver.catalog to your local machine
2)	download the sample wsdl files (and schema) to a local directory
3)	edit the local file names in simpleresolver.catalog to point to the downloaded files
4)	compile and run the test.

Running:

Arg0 - the source wsdl
Arg1 (optional) - OM | DOM - selects the corresponding parser to use in the test. Default is Woden default parser (currently DOM).

The easiest way is to point to your simpleresolver.catalog from the command line (or IDE equivalent), something like:

> java -Dorg.apache.woden.resolver.simpleresolver.catalog=c:\simpleresolver.catalog wsdl20test.Woden14SimpleResolverTest c:\woden-14test\woden14.wsdl OM


> Use XML Catalog To Improve Performance and Enable Offline Work
> --------------------------------------------------------------
>
>                 Key: WODEN-14
>                 URL: http://issues.apache.org/jira/browse/WODEN-14
>             Project: Woden
>          Issue Type: New Feature
>          Components: Parser
>            Reporter: Arthur Ryman
>         Assigned To: Lawrence Mandel
>         Attachments: woden-14-patch1.txt
>
>
> Woden currently retrieves XML schemas from the Internet each time it performs a validator. This causes a multisecond performance degradation and prevents validation from working when there is no Internet access.
> Woden should use an XML catalog to resolve references to Internet resources. There should be an API for controlling the XML catalog so that Woden can be imbedded in other systems, such as Eclipse and Ant, that provide XML catalogs.
> The XML catalog should be consulted when resolving all resource requests, e.g. for XML schema or WSDL.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org