Monday, March 16, 2009

Global URI re-writing with jax-ws-catalog.xml

Spending a little bit of time looking into jax-ws-catalog files in order to add support for a future version of JDeveloper. JAX-WS appears to have good support for the OASIS Catalog specification: so as well as providing indirections for individual URLS:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
  <system systemId="http://localhost.localdomain:7101/Application1-Project1-context-root/HelloPort?WSDL"
          uri="http://production:7101/Application1-Project1-context-root/HelloPort?WSDL"/> 
</catalog>

the catalog can also be used to re-write all URLS:


<?xml version="1.0" encoding="ISO-8859-1" ?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
  <rewriteURI
    uriStartString = "http://localhost.localdomain:7101/"
    rewritePrefix = "http://production:7101/" />        
</catalog>

Although you could create a catalog file for WAR and JAR in your project, you can just create the file once at the EAR file level. For JDeveloper users this can be created directly under "Application Resources".

This catalogue file will be used by all the proxies, you will find that due to a bug in weblogic the service will fail to deploy if the original URL is not available. So for the moment this is a useful hack for non-production environments only with weblogic; but will probably work fine for other application servers. Also do remember this is only going to work for JAX-WS services.

8 comments:

dKt said...

To take this one step further, using the jax-ws-catalog.xml can stop a JAX-WS client from making network calls at runtime to pull WSDL and XSD files, but the client will still parse the WSDL and any XSD files each time you ask for a port object. I'm trying to add a web service call to a standard web app running in Weblogic 10.3, and it seems the recommendation is to use the clientgen ant task with the 'JAXWS' type. Our WSDL imports a number of giant XSDs. At runtime, even if I cache the service object, each time I ask for a port object from the service, the client code builds an entire DOM object of the WSDL and XSDs. Using the jax-ws-catalog.xml only tells the client to use embedded copies of the WSDL and XSDs. This seems like a hideous design problem on the part of the Oracle JAX-WS 2.1.3 library, and would cause any app that uses it to run painfully slowly and run out of memory in a jiffy. Know anything about this?

Gerard Davison said...

dKt,

This sounds like a bug I will take a look at it,

Gerard

Gerard Davison said...

Hey,

I have looked into this and confirmed you issue, I have raised an Oracle internal bug 8595190, and you can track this with your support representative.

Can you confirm performance / memory issues have been measured or are they presumed?

Gerard

Aziz Hendricks said...

Hi Gerrad,

Do you recall if there was a resolution to this bug? We're currently experiencing it in our Production Environment.

Gerard Davison said...

Fixed in 10.3.2.0 or PS1 depending which versioning system you like best.

Barbara said...

Hi guys,
I'm having the same problem with Oracle WL Server 10.3.0.
So, when I read about the internal Oracle bug (8595190) and its solution, I have tried to have more information about it.
I told an Oracle expert to look for this bug but nothing: he didn't found it.
Are you sure the number of this bug is 8595190? Could you post the sentences of this bug? Are you sure that it has been solved with WL Server 10.3.2?
I would like to have more informations.
Thank you.
Barbara

Gerard Davison said...

Barbara,

I have just checked and this is the correct bug number, it even references this blog!

The title for the bug is "PERF: SCHEMA READ ON EACH PORT CREATION"

Gerard

Unknown said...

We have lots of EARs deployed to Weblogic and would like to use catalog files to rewrite URLs to local files. Does this mean that we have to add the catalog file to each EAR, orr is there some way to pick it from a shared library?