axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [jira] Created: (AXIS-1374) wsdl2java does not deal with java.sql.date properly
Date Sun, 30 May 2004 02:01:00 GMT
Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1374

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1374
    Summary: wsdl2java does not deal with java.sql.date properly
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             WSDL processing
   Versions:
             1.1

   Assignee: 
   Reporter: Erich Pletsch

    Created: Sat, 29 May 2004 6:59 PM
    Updated: Sat, 29 May 2004 6:59 PM
Environment: all

Description:
When you attempt to generate a WSDL file from a java class that utilizes java.sql.Date using
java2wsdl the generated WSDL file will write the method signature as type of dateTime (java.util.Date)
which will cause you to receive an error later when you attempt to deploy your object.  The
following is the error:

OperationDesc for xxx was not sychronized to a method of yyy.yyy.yyy where xxx is the method
name in class yyy.yyy.yyy

/**********************************************************/
 *Code example:
 */

//Here is a simple example class importing type java.sql.Date

package com.yourcompany.edi;

import java.sql.Date;

public class XMLRPC implements com.yourcompany.XMLRPC{

	public XMLRPC() {
		this.ds = new Datastore();
	}

	//Add User
	public boolean addUser(String sUser, String sPass, Date dDate)	{
		return true;
	}
}

/**********************************************************/
<!--Here is the specification in the WSDL file (excerpt only) that will be generated by
java2wsdl-->
<wsdl:message name="getAccountTransactionsSinceRequest">
      <wsdl:part name="sUser" type="xsd:string"/>
      <wsdl:part name="sPass" type="xsd:string"/>    
      <wsdl:part name="dDate" type="xsd:dateTime"/>
</wsdl:message>

/**********************************************************/

The above example will result in the following error at deploytime:

OperationDesc for addUser was not synchronized to a method of 
com.yourcompany.edi.XMLRPC

The reason for the error is that the wsdl specification dateTime is implemented as java.util.Date
and your import in the actual class is importing java.sql.Date (without specifying it implicitly
in the method signature)

To work around this problem in your java class modify the code as follows:

/**********************************************************/
 *Code example:
 */

//Here is a simple example class importing type java.sql.Date

package com.yourcompany.edi;

import java.util.Date;

public class XMLRPC implements com.yourcompany.XMLRPC{

	public XMLRPC() {
		this.ds = new Datastore();
	}

	//Add User
	public boolean addUser(String sUser, String sPass, Date dDate)	{
		//Then if for some reason you absolutely must have
		//java.sql.date, cast it in here.
		return true;
	}
}

/**********************************************************/

However, a long term fix for java2wsdl is advisable as anyone who attempts to use java.sql.Date
will run into problems here.




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message