2 Replies Latest reply on Oct 1, 2004 1:37 PM by dexterwong

    How to map java.sql.Time to xsd:Time

    Simon Godden Newbie

      Can anyone explain how to map java.sql.Time to xsd:Time using ws4ee (jboss4.0.0).

      The axis java-to-wsdl tool cannot handle it and replaces it with a xsd:anyType in the WSDL.

        • 1. Re: How to map java.sql.Time to xsd:Time
          dexterwong Newbie

          Hi,
          this will not help you, but I get the same results from axis 1.1 and axis 1.2 (the java versions).
          If I use wscompile from sun I get the following

          C:\axis-1_2beta\samples\test>wscompile -define -mapping build/mapping.xml -d bui
          ld/ -nd build/ -classpath C:\axis-1_2beta\samples\test\build;%CLASSPATH% -verbos
          e config-interface.xml
          [creating model: A]
          [creating service: A]
          [creating port: samples.test.A]
          [creating operation: test]
          error: class java.sql.Time does not have a public accessible empty constructor

          Reading the j2ee docs it say

          To be supported by JAX-RPC, a value type must conform to the following rules:

          It must have a public default constructor.
          It must not implement (either directly or indirectly) the java.rmi.Remote interface.
          Its fields must be supported JAX-RPC types.

          Maybe you can try creating your wsdl with another tool. Maybe microsoft wsdl
          generator? Good luck

          --------------------------------------------------------------------------------------------------

          My config-interface.xml is

          <?xml version="1.0" encoding="UTF-8"?>






          • 2. Re: How to map java.sql.Time to xsd:Time
            dexterwong Newbie

            Hi,
            just curious can you do the following,

            1. Update your web service method to use java.util.Date for return value or
            input parameters
            2. You client code has java.sql.Time call getTime() to get a long. Use this
            to create a java.util.Date. Pass this parameter to your web service.
            3. Your web service will take the java.util.Date and call getTime() to get a long. Use this to create a java.sql.Time. The use it in your business logic implementation.

            Note: I create a sime java interface that uses java.util.Date and I get
            something similar to what you want in your wsdl. Meaning

            package samples.test;

            import java.util.*;

            public interface Test {
            public void api(Date date);
            }


            --------------- partial wsdl -----------------------------------
            <?xml version="1.0" encoding="UTF-8"?>
            <wsdl:definitions targetNamespace="http://test.samples" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://test.samples" xmlns:intf="http://test.samples" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <!--WSDL created by Apache Axis version: 1.2beta
            Built on Mar 31, 2004 (12:47:03 EST)-->
            <wsdl:types>












            </wsdl:types>

            -dwong