Web服务响应中的日期为null [英] Date is null in Web Service response

查看:79
本文介绍了Web服务响应中的日期为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个向JAX Web服务请求某些数据的客户端.我使用wsimport命令(已安装Java 7u45)从wsdl生成客户机类.我没有问题就可以找回字符串类型,但是日期类型在Java代码中将变为null.这是我得到的肥皂回应:

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>

szuletesiIdo在wsdl中定义:

The szuletesiIdo is defined in the wsdl:

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

和其他元素是字符串类型.在Java代码中,获取字符串值没有问题,但是响应中的XmlGregorianCalendar szuletesiIdo字段始终为null.请帮助我.

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.

推荐答案

xsd:date格式应为ISO日期格式为"2013-12-18T23:15:10",但响应中的格式不正确"1948.09.05",请与服务提供商联系以更正其日期格式.

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.

这篇关于Web服务响应中的日期为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆