Date is null in Web Service response

倖福魔咒の 提交于 2019-12-13 06:03:35

问题


I'm trying to implement a client which asks a JAX Web Service for certain data. I used the wsimport command (Java 7u45 is installed) to generate the client classes from the wsdl. I have no problem getting back the string types but the date type becomes null in the Java code. This is what I get back as a soap response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:SearchControllerwsdl"><SOAP-ENV:Body><ns1:TorzsHorizontFelirAzonKeresE1Response><TorzsHorizontFelirAzonKeresE1Result><item><keresId>433</keresId><nev>Test Name</nev><szuletesiIdo>1948.09.05</szuletesiIdo><felirAzon>000000011</felirAzon><adoSzam>11111111</adoSzam><hibaKod>0</hibaKod><hibaSzoveg/></item></TorzsHorizontFelirAzonKeresE1Result></ns1:TorzsHorizontFelirAzonKeresE1Response></SOAP-ENV:Body></SOAP-ENV:Envelope>

The szuletesiIdo is defined in the wsdl:

<xsd:element name="szuletesiIdo" type="xsd:date"/>

and the other elements are string types. In the Java code I have no problem getting the string values, but the XmlGregorianCalendar szuletesiIdo field in the response is always null. Please help me with this.


回答1:


The xsd:date format should be the ISO date format as "2013-12-18T23:15:10", but the one in the response is not correct "1948.09.05", check with the service provider to correct the date format from his side.



来源:https://stackoverflow.com/questions/20633692/date-is-null-in-web-service-response

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!