Android Can';t使用改型2和简单的XML转换器获取Soap列表
我正在尝试解析下一个SOAP响应:Android Can';t使用改型2和简单的XML转换器获取Soap列表,android,soap,retrofit2,simple-framework,Android,Soap,Retrofit2,Simple Framework,我正在尝试解析下一个SOAP响应: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<tt_statemonitorMobileAdResponse xmlns="http://monitoring-gps.com.ua/aspservices/">
<tt_statemonitorMobileAdResult>
<statuscode>4</statuscode>
<uiaction>0</uiaction>
<data>
<anyType xsi:type="TtMobileStateData">
<tt_id>1000002502</tt_id>
<speed>0</speed>
<angle>0</angle>
<ign>0</ign>
<fuel>132</fuel>
<driver_id>-1</driver_id>
<satellites>20</satellites>
<driver />
<name>AA0873KT</name>
<lat>50.4441</lat>
<lon>30.6471</lon>
<date>07-10-2017 16:11:50</date>
<address>32, Гродненская улица, Дарница, Днепровский район, Киев, 02090, Украина</address>
<actual>1</actual>
<is_bs>0</is_bs>
<bsList />
<isMove>false</isMove>
<necessary_to_replace>false</necessary_to_replace>
<movesec>0</movesec>
<stopsec>20075</stopsec>
<devicetype_id>1</devicetype_id>
<devicetype>Автомобильный Трекер</devicetype>
<devicemodel_id>16</devicemodel_id>
<devicemodel>BI 864 TREK v2</devicemodel>
<battery_replacement />
<pointCount>0</pointCount>
<timeconnect>07.10.2017 16:11:24</timeconnect>
</anyType>
<anyType xsi:type="TtMobileStateData">
<tt_id>1000002514</tt_id>
<speed>69</speed>
<angle>147</angle>
<ign>1</ign>
<fuel>316</fuel>
<driver_id>-1</driver_id>
<satellites>20</satellites>
<driver />
<name>AA0872KT</name>
<lat>48.5748</lat>
<lon>23.0335</lon>
<date>07-10-2017 16:12:00</date>
<address>М-06, Свалявский район, Закарпатская область, 89308, Украина</address>
<actual>1</actual>
<is_bs>0</is_bs>
<bsList />
<isMove>true</isMove>
<necessary_to_replace>false</necessary_to_replace>
<movesec>1243</movesec>
<stopsec>0</stopsec>
<devicetype_id>1</devicetype_id>
<devicetype>Автомобильный Трекер</devicetype>
<devicemodel_id>16</devicemodel_id>
<devicemodel>BI 864 TREK v2</devicemodel>
<battery_replacement />
<pointCount>0</pointCount>
<timeconnect>07.10.2017 15:59:33</timeconnect>
</anyType>
<anyType xsi:type="TtMobileStateData">
<tt_id>1000002527</tt_id>
<speed>0</speed>
<angle>0</angle>
<ign>0</ign>
<fuel>172</fuel>
<driver_id>-1</driver_id>
<satellites>0</satellites>
<driver />
<name>AA2049EA</name>
<lat>50.444</lat>
<lon>30.647</lon>
<date>07-10-2017 16:09:56</date>
<address>32, Гродненская улица, Дарница, Днепровский район, Киев, 02090, Украина</address>
<actual>1</actual>
<is_bs>0</is_bs>
<bsList />
<isMove>false</isMove>
<necessary_to_replace>false</necessary_to_replace>
<movesec>0</movesec>
<stopsec>16120</stopsec>
<devicetype_id>1</devicetype_id>
<devicetype>Автомобильный Трекер</devicetype>
<devicemodel_id>16</devicemodel_id>
<devicemodel>BI 864 TREK v2</devicemodel>
<battery_replacement />
<pointCount>0</pointCount>
<timeconnect>07.10.2017 16:09:33</timeconnect>
</anyType>
<anyType xsi:type="TtMobileStateData">
<tt_id>1000003365</tt_id>
<speed>0</speed>
<angle>0</angle>
<ign>0</ign>
<fuel>0</fuel>
<driver_id>-1</driver_id>
<satellites>16</satellites>
<driver />
<name>Hilux 73</name>
<lat>49.5637</lat>
<lon>34.5297</lon>
<date>07-10-2017 16:12:17</date>
<address>Европейская улица, Полтава, Шевченковский район, Полтава, Полтавская область, 36000-36499, Украина</address>
<actual>1</actual>
<is_bs>0</is_bs>
<bsList />
<isMove>false</isMove>
<necessary_to_replace>false</necessary_to_replace>
<movesec>0</movesec>
<stopsec>89852</stopsec>
<devicetype_id>1</devicetype_id>
<devicetype>Автомобильный Трекер</devicetype>
<devicemodel_id>18</devicemodel_id>
<devicemodel>BI 820 TREK</devicemodel>
<battery_replacement />
<pointCount>0</pointCount>
<timeconnect>07.10.2017 14:43:32</timeconnect>
</anyType>
</data>
<length>4</length>
<ttstates>
<tt_id>0</tt_id>
<speed>0</speed>
<angle>0</angle>
<ign>0</ign>
<fuel>0</fuel>
<driver_id>0</driver_id>
<satellites>0</satellites>
<lat>0</lat>
<lon>0</lon>
<actual>0</actual>
<is_bs>0</is_bs>
<isMove>false</isMove>
<necessary_to_replace>false</necessary_to_replace>
<movesec>0</movesec>
<stopsec>0</stopsec>
<devicetype_id>0</devicetype_id>
<devicemodel_id>0</devicemodel_id>
<pointCount>0</pointCount>
</ttstates>
</tt_statemonitorMobileAdResult>
</tt_statemonitorMobileAdResponse>
</soap:Body>
</soap:Envelope>
改装响应成功,但当我尝试获取列表时,它会显示下一个错误:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.monitoring.gpsmayak.api.response.statemonitor.StatemonitorResponseData.getStatemonitorList()' on a null object reference
请让我知道我应该在代码中更改什么。
我不确定,但我认为问题在于我不知道如何解析xsi:type=“TtMobileStateData”
我在这里也发现了类似的问题:
但我不知道如何在我的情况下实现这一点问题解决了。
我刚换了衣服
@ElementList(name = "anyType", required = false, inline = true)
到
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.monitoring.gpsmayak.api.response.statemonitor.StatemonitorResponseData.getStatemonitorList()' on a null object reference
@ElementList(name = "anyType", required = false, inline = true)
@ElementList(entry = "anyType", required = false, inline = true)