Reputation: 334
I am writing a web service client for a 3rdparty web service. The web service is using XMLGregorianCalendar to send the time stamp. When i invoked the web method I am getting an exception with error message
Input request field Start Date/Time has an invalid value.
Invalid DateTime value 2012-01-01T05:05:05, expected in format YYYY-MM-DD-HH.MM.SS
Is it possible to override the xml binding in client side of web service and if possible how.
Upvotes: 0
Views: 1193
Reputation: 517
I also had the same issue and was able to solve it by customising the jaxb binding at client side.
You can do this by creating a jaxb customization xml and use it while generating the client stubs.
jaxb customization file that I have created is added below
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
wsdlLocation="relative url to wsdl location">
<jaxb:globalBindings>
<jaxb:serializable/>
<jaxb:javaType name="java.lang.String" xmlType="xsd:dateTime"/>
</jaxb:globalBindings>
</jaxws:bindings>
In the above file dateTime will be created as String in the stub. Hope that helps.
Upvotes: 1