Pankaj Gupta ha scritto:
Hi,
I am new to webservices and axis. I am using wsdl2java tool to create
java source files. The problem is that the tool creates a reference of
org.apache.axis.types.PositiveInteger class for xsd:positiveInteger
data type. I dont want to make my SOAP service dependent on Axis. Is
there any way I can plugin my own class for positiveInteger instead of
Axis class. Or any way in which I can alter the schema definition in
such a way that it uses only data types matching java types.
My xsd contains following definition:
<xsd:simpleType name="ProductIdInteger">
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxInclusive value="999999"/>
</xsd:restriction>
</xsd:simpleType>
regards,
Pankaj
First, have a look at:
http://ws.apache.org/axis2/1_3/adb/adb-tweaking.html#config
The solution is to:
- create your own schema-compile.properties (use the original coming
with Axis2 as the starting base; you'll find it in
axis2-1.3\modules\adb-codegen\src\org\apache\axis2\schema in
axis2-1.3-src.zip source bundle)
- set the System Property called "org.apache.adb.properties" to point to
your own schema-compile.properties; e.g.:
set JAVA_OPTS=-Dorg.apache.adb.properties=/my-schema-compile.properties
WSDL2Java ...
- provide a custom implementation of
org.apache.axis2.schema.typemap.TypeMap and specify that as the value
for schema.bean.typemap property in your own schema-compile.properties
You could use org.apache.axis2.schema.typemap.JavaTypeMap as the
starting point and change just the mapping for xsd:positiveInteger.
For my own needs, I personally did an implementation of TypeMap that
uses an instance of Axis2 JavaTypeMap as the base, then reads new and
overridden mappings from an XML file. I think it would be more simple if
Axis2 adopted such an approach by default...
Hope this helps.
--
Mauro Molinari
Software Developer
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]