在使用JAX-RPC wscompile ANT任务从WSDL生成java类时,我遇到了一个问题。
我的ant脚本:
<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile" classpathref="jaxrpc.classpath"/>
<taskdef name="wsdeploy" classname="com.sun.xml.rpc.tools.ant.Wsdeploy" classpathref="jaxrpc.classpath"/>
<wscompile
fork="true"
base="${target.jaxrpc.dir}"
server="true"
client="false"
features="documentliteral"
model="${target.jaxrpc.dir}/model.xml.gz"
debug="true"
keep="true"
verbose="true"
config="${src.main.config.dir}/jaxrpc-service-config.xml">
<classpath refid="jaxrpc.classpath"/>
</wscompile>在我的wsdl中有Date类型的对象,问题是JAX-RPC生成Calendar对象。有没有办法设置一些标志,或者以某种方式强制JAX-RPC生成Date对象?
发布于 2012-01-17 16:34:07
这是因为Enterprise Web Services1.1规范定义了Java类和XML之间的缺省映射。您可以更改application.You的缺省映射,也可以通过编辑element JAX- types.However映射文件的内容来更改映射。在您的情况下,您必须进行以下更改:
<java-wsdl-mapping>
...
<java-xml-type-mapping>
<java-type>java.util.Date</java-type>
<root-type-qname xmlns:qn="http://www.w3c.org/2001/XMLSchema">qn:dateTime</root-type-qname>
</java-xml-type-mapping>
...
<java-wsdl-mapping>https://stackoverflow.com/questions/8891428
复制相似问题