jQuery in Action, 3rd edition
The moose likes Web Services and the fly likes Web Service client failing on an empty date node Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service client failing on an empty date node" Watch "Web Service client failing on an empty date node" New topic

Web Service client failing on an empty date node

Josh Rose

Joined: Jul 26, 2013
Posts: 2
Good morning,

I'm at my wit's end with this web service client failing on an empty node that is returned. Hoping someone here will know what's going on and what I can do to fix it.

Here's the relevant node in the XSD:
<xsd:element name="resolution" minOccurs="0">
<xsd:element name="start" type="xsd:date" minOccurs="0"/>

Here's the relevant node being returned back when I run soapUI.

Here's the Exception I'm getting.
org.xml.sax.SAXException: Invalid date
java.lang.NumberFormatException: Invalid date
at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:180)
at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.walmartstores.xmlns.www.BusinessServiceManagement.IncidentManagement.wsdl.QueryIncident._4_1.QueryIncidentInterfaceSOAP11HTTPStub.getIncidentByNumber(QueryIncidentInterfaceSOAP11HTTPStub.java:2123)
at query.TestQueryTicket.testQueryTicketByNumber(TestQueryTicket.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NumberFormatException: Invalid date
at org.apache.axis.encoding.ser.DateDeserializer.makeValue(DateDeserializer.java:60)
at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:172)
... 33 more

Please let me know if anything else is needed and thank you for your help.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
If this was my problem I would first use TCPMON or SOAPui to find out exactly what is being transmitted in the request. You may be surprised!

Kesava Krishna
Ranch Hand

Joined: Sep 03, 2012
Posts: 42

Please post your client code, how you are calling the service. It is clear from the exception the way how you are passing parameters to the service is wrong.
Pasting you client code will help in identifying the issue.

g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 607
The schema is hopeless wrong in the sense that the validator is in no way to proceed any further when it encounters that sort of schema. I hope you're not going to tell us it is a mishap copy-and-paste. Start all over again with this.
Kesava Krishna
Ranch Hand

Joined: Sep 03, 2012
Posts: 42
Try with xsd:dateTime instead of xsd:date.

Josh Rose

Joined: Jul 26, 2013
Posts: 2
Figured out what was going on. It was trying to pass "" to a Date field, which was causing the errors. When I changed the type to String, it had no issue. From there, it was trivial to simply check for "" in the code.
I agree. Here's the link: http://aspose.com/file-tools
subject: Web Service client failing on an empty date node
It's not a secret anymore!