axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (AXIS2-2701) Problem with ADBBean generated with WSDL2Java and Date type
Date Thu, 26 Jul 2007 04:25:31 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Amila Chinthaka Suriarachchi reopened AXIS2-2701:
-------------------------------------------------


the way I have fixed this issue is wrong. in POJO date is mapped to dateTime rather than date.
So calling to CovertToDate method is wrong in deserializing it. 
when deserializing it should deserialize it as a dateTime.

> Problem with ADBBean generated with WSDL2Java and Date type
> -----------------------------------------------------------
>
>                 Key: AXIS2-2701
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2701
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>            Reporter: Michèle Vialatte
>            Assignee: Amila Chinthaka Suriarachchi
>
> My WebService java client uses ADBBeans generated with 'org.apache.axis2.wsdl.WSDL2Java'.

> The wsdl file contains an element of type="xs:date" :
> 	<xs:element name="Contact"> 
> 		<xs:complexType> 
> 			<xs:sequence> 
> 				... ... ... 
> 				<xs:element name="contactDate" type="xs:date" nillable="true" /> 
> 				... ... ... 
> 			</xs:sequence> 
> 		</xs:complexType> 
> 	</xs:element>
> The class generated contains a java.util.Date localContactDate :
> public  class Contact
>         implements org.apache.axis2.databinding.ADBBean{ 
> 		...    
>         protected java.util.Date localContactDate ;
>         ...
>         
>         public void serialize(final javax.xml.namespace.QName parentQName,
>                          final org.apache.axiom.om.OMFactory factory,
>                          javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
{
>     		....
>     		xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localContactDate));
>     		....
>     	}
>     	...
>     	
>     	public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName
qName){
> 			....
>     		elementList.add(localContactDate==null?null:
>                       org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localContactDate));
>     		....
>     	}
>     	...
>         
> }   
> The problem is that ConverterUtil.convertToString(date) converts the date in a String
of format "yyyy-MM-dd'Z'" to put in the XML
> and after that, in the Server, during the deserialization, the SimpleTypeMapper class
throws an Exception if the String read has a length less than 19 !!!
> in 'org.apache.axis2.databinding.utils.ConverterUtil.java' : 
> 		
> 		public static String convertToString(Date value) {
> 	        // lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz?
> 	        // we have to serialize it with the GMT timezone
> 	        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'Z'");
> 	        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
> 	        return simpleDateFormat.format(value);
> 	    }     
> 	    
> in 'org.apache.axis2.databinding.typemapping.SimpleTypeMapper.java' :
>  		private static final String W_DATE = "java.util.Date";
>  		...
> 		public static Object getSimpleTypeObject(Class parameter, OMElement value) {
> 		    String name = parameter.getName();
> 		    String text = value.getText();
> 		    ...
> 		    if (name.equals(W_DATE)) { 
> 	            return makeCalendar(text, true);
> 	        }
> 	        ...
> 	    }
> 	    ...
> 	    public static Object makeCalendar(String source, boolean returnDate) {
>       		...
>       		if (source.length() < 19) {
>             	throw new NumberFormatException("Calendar string too short");
>             ...	
>         }
> 	    
> Execution.
> Logs in the Tomcat Server :
> [23/05/2007 12:10:49:DEBUG] StAXUtils.java                     :242   XMLStreamWriter
is com.ctc.wstx.sw.SimpleNsStreamWriter
> ...
> [23/05/2007 12:10:49:DEBUG] StAXOMBuilder.java                 :132   START_ELEMENT:
{http://adp-intranet/wsmodule/ContactWS/1.0.0}contactDate:contactDate
> [23/05/2007 12:10:49:DEBUG] StAXSOAPModelBuilder.java          :194   Build the OMElelment
contactDateBy the StaxSOAPModelBuilder
> [23/05/2007 12:10:49:DEBUG] StAXOMBuilder.java                 :149   CHARACTERS: [2007-05-23Z]
> [23/05/2007 12:10:49:DEBUG] StAXOMBuilder.java                 :161   END_ELEMENT: {http://adp-intranet/wsmodule/ContactWS/1.0.0}contactDate:contactDate
> ...
> ...
> java.lang.NumberFormatException: Calendar string too short
> 	at org.apache.axis2.databinding.typemapping.SimpleTypeMapper.makeCalendar(SimpleTypeMapper.java:314)
> 	at org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:115)
> 	at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:398)
> 	at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:406)
> 	at org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:676)
> 	at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:624)
> 	at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:560)
> 	at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:118)
> 	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:113)
> 	at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
> 	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
> 	at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
> 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
> 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
> 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
> 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> 	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
> 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
> 	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
> 	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
> 	at java.lang.Thread.run(Thread.java:534)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message