문제

I have a problem when generating java classes from WSDL using JAX-RPC wscompile ANT task.

My ant script:

<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>

In my wsdl there is Date type objects, the problem is that JAX-RPC generates Calendar objects. Is there a way to set some flag or somehow to force JAX-RPC to generate Date objects?

도움이 되었습니까?

해결책

This is because the Enterprise Web Services 1.1 specification defines the default mapping between Java classes and XML types.However you can change the default mapping for your application.You can change the mapping by editing the contents of the element JAX-RPC mapping file. In your case you have to do following changes:

    <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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top