我有Web服务,它返回XML数据。但在数据中,我在它的开头接收到Null字段。实际数据也可用,但后面跟着Null字段。我正在使用ksoap2访问Android中的web服务。 SoapObject变量具有完整数据,但也具有那些空字段,这对于使用此服务有点创建问题。在这里你可以看到,在开始时它什么都没有,但后来它的数据以Tag“Title”开头
04-12 10:55:09.405: D/ENVELOPE(1394): GetGuestEventsListingForServiceResponse{GetGuestEventsListingForServiceResult=anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; }; }; }; }; diffgram=anyType{NewDataSet=anyType{Table=anyType{Title=THE CLUSTER DAY-1, JUNKOVATION; Description=anyType{}; EventDate=Apr 12, 2013; EventTime=5:00 PM; Venue=BLOCK 13-306; CreatedBy=16689; CreatedOn=2013-04-11T09:52:07.163+05:30; EventFor=All; Type=Internal; IsActive=true; };
答案 0 :(得分:1)
我不明白问题出在哪里。如果将结果字符串格式化为xml,则可以获得:
<GetGuestEventsListingForServiceResponse>
<GetGuestEventsListingForServiceResult>
<schema>
<element>
<complexType>
<choice>
<element>
<complexType>
<sequence>
<element/>
<element/>
<element/>
<element/>
<element/>
<element/>
<element/>
<element/>
<element/>
<element/>
</sequence>
</complexType>
</element>
</choice>
</complexType>
</element>
</schema>
<diffgram>
<NewDataSet>
<Table>
<Title>THE CLUSTER DAY-1, JUNKOVATION</Title>
<Description/>
<EventDate>Apr 12, 2013</EventDate>
<EventTime>5:00 PM</EventTime>
<Venue>BLOCK 13-306</Venue>
<CreatedBy>16689</CreatedBy>
<CreatedOn>2013-04-11T09:52:07.163+05:30</CreatedOn>
<EventFor>All</EventFor>
<Type>Internal</Type>
<IsActive>true</IsActive>
</Table>
</NewDataSet>
</diffgram>
</GetGuestEventsListingForServiceResult>
</GetGuestEventsListingForServiceResponse>
如果你的意思是为什么有那些empties元素,你必须检查服务器端的Web服务。如果要与服务器端的“.NET”Web服务连接,请尝试将绑定设置为BasicBinding