axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alistair Edwardes <alistair.edwar...@geo.uzh.ch>
Subject Re: externalMapping to reuse types
Date Thu, 31 Jan 2008 10:29:30 GMT
Hi Mauro

Thanks for you tips. After banging my head against a wall with the 
externalMappings option I think you're right I should build all the 
classes and just throw away the duplicated ones. Your point about 
namespace-packages is good too. Actually, I try not to inline datatypes 
in wsdl anyway, I prefer to include/import seperate xsds that model all 
the data types in their own namespace. 

So, just to give a bit of feed back (to you but mainly to anyone who 
might have a similar problem who reads this thread later). One way to 
manage the namespace to package mapping is  through the namespaceURIs 
option of wsdl2code - note the documentation on the website is wrong 
here you have to define them with an element called <packageName> not 
<package>.

BUT... much better is to use the xsdconfig option. Of course there's no 
documentation on how to use this with wsdl2code- though the 
documentation about it on the xmlbeans pages is useful.

To use it you need to add in your <configuration> something like
<options>
            <property>
              <name>xc</name>
              <value>src/main/resources/xsdconfig/config.xsdconfig</value>
            </property>
</options>

where the <value> points to an xsdconfig file. (for example see 
http://dev2dev.bea.com/pub/a/2004/11/Configuring_XMLBeans.html ). NOTE.. 
you have to use xc as the parameter name, the long form, xsdconfig, 
doesn't seem to work.

The advantage of the .xsdconfig file is you can set both namespace 
mappings and qname to java class mappings. I think this might actually 
be what the external-mapping option is supposed to be for too - I've 
taken the liberty of cc-ing the author of that so maybe they could shed 
a bit more light on it.

So, for example I have the namespace to package mapping

<xb:namespace uri="http://www.opengis.net/gml">
        <xb:package>net.opengis.gml</xb:package>
</xb:namespace>

and, an element to java class mapping

<xb:qname name="gml:posList" javaname="DirectPositionList" />

which is similar to what I think you were trying to achieve before too.

Cheers Alistair


Mauro Molinari wrote:
> Hai Alistair,
> I also posted a question about external mapping some time ago but 
> never got an anwser.
> For what I could understand by my own, that file is aumatically 
> compiled when there are globally defined types in schemas. Maybe you 
> can also edit it by hand, but I can't say what it could be really 
> useful for...
>
> From my own personal experience, I try to share schema files in this way:
> - shared types are defined in their own namespace, so that WSDL2Java 
> generates classes in the own (shared) packages
> - every time I do a WSDL2Java for a WSDL that uses shared schemas, I 
> throw away the newly generated classes for the shared types and I use 
> the previously generated ones, which actually are the same classes
>
> If I could understand your situation well, I think that the key to 
> solve your problem is to carefully choose namespaces (i.e.: Java 
> packages!) for both WSDLs inline schemas and shared XSD schemas.
>
> I hope this helps a bit...
>


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


Mime
View raw message