今天发现一个可以提供火车票时刻表查询的WebService,先记录下来以后如果写一个火车票时刻表查询的Android App的话就用的着。首先该WebService的的名字是TrainTimeWebService,地址是:http://webservice.webxml.com.cn/WebServices/TrainTimeWebService.asmx。
当然关于WebService的相关知识可以查看本人的另外文章:
getStationNameDataSet :
<StationName diffgr:id="StationName1985" msdata:rowOrder="1984"> <station_name>深圳</station_name> <station_shortcode>SZ</station_shortcode> </StationName> <StationName diffgr:id="StationName2001" msdata:rowOrder="2000"> <station_name>深圳西</station_name> <station_shortcode>SZX</station_shortcode> </StationName> <StationName diffgr:id="StationName86" msdata:rowOrder="85"> <station_name>深圳北</station_name> <station_shortcode/> </StationName> <StationName diffgr:id="StationName87" msdata:rowOrder="86"> <station_name>深圳东</station_name> <station_shortcode/> </StationName>
getStationName :
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>深圳</string> <string>深圳北</string> <string>深圳东</string> <string>深圳西</string> </ArrayOfString>
getStationAndTimeDataSetByTrainCode :
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <getStationAndTime xmlns=""> <TimeTable diffgr:id="TimeTable1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> <TrainCode>D7001</TrainCode> <FirstStation>广州</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州</StartStation> <StartTime>06:03:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>147</KM> <UseDate>1:31</UseDate> </TimeTable> </getStationAndTime> </diffgr:diffgram>
<getStationAndTime xmlns=""> <TimeTable diffgr:id="TimeTable1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> <TrainCode>D7001</TrainCode> <FirstStation>广州</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州</StartStation> <StartTime>06:03:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>147</KM> <UseDate>1:31</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable2" msdata:rowOrder="1" diffgr:hasChanges="inserted"> <TrainCode>D7002</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州</LastStation> <StartStation>深圳</StartStation> <StartTime>07:46:00</StartTime> <ArriveStation>广州</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>147</KM> <UseDate>1:34</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable3" msdata:rowOrder="2" diffgr:hasChanges="inserted"> <TrainCode>D7003</TrainCode> <FirstStation>广州</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州</StartStation> <StartTime>09:32:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>147</KM> <UseDate>1:35</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable4" msdata:rowOrder="3" diffgr:hasChanges="inserted"> <TrainCode>D7004</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州东</LastStation> <StartStation>深圳</StartStation> <StartTime>11:20:00</StartTime> <ArriveStation>广州东</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable5" msdata:rowOrder="4" diffgr:hasChanges="inserted"> <TrainCode>D7005</TrainCode> <FirstStation>广州东</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州东</StartStation> <StartTime>12:54:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable6" msdata:rowOrder="5" diffgr:hasChanges="inserted"> <TrainCode>D7006</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州东</LastStation> <StartStation>深圳</StartStation> <StartTime>14:25:00</StartTime> <ArriveStation>广州东</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable7" msdata:rowOrder="6" diffgr:hasChanges="inserted"> <TrainCode>D7007</TrainCode> <FirstStation>广州东</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州东</StartStation> <StartTime>15:56:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable8" msdata:rowOrder="7" diffgr:hasChanges="inserted"> <TrainCode>D7008</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州东</LastStation> <StartStation>深圳</StartStation> <StartTime>17:27:00</StartTime> <ArriveStation>广州东</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable9" msdata:rowOrder="8" diffgr:hasChanges="inserted"> <TrainCode>D7009</TrainCode> <FirstStation>广州东</FirstStation> <LastStation>深圳</LastStation> <StartStation>广州东</StartStation> <StartTime>18:58:00</StartTime> <ArriveStation>深圳</ArriveStation> <ArriveTime>07:34:00</ArriveTime> <KM>139</KM> <UseDate>1:19</UseDate> </TimeTable> </getStationAndTime>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>D7001</string> <string>广州</string> <string>深圳</string> <string>广州</string> <string>06:03:00</string> <string>深圳</string> <string>07:34:00</string> <string>147</string> <string>1:31</string> <string/> </ArrayOfString>
<getStationAndTime xmlns=""> <TimeTable diffgr:id="TimeTable1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> <TrainCode>D7002</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州</LastStation> <StartStation>深圳</StartStation> <StartTime>07:46:00</StartTime> <ArriveStation>广州东</ArriveStation> <ArriveTime>09:05:00</ArriveTime> <KM>139</KM> <UseDate>01:19</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable2" msdata:rowOrder="1" diffgr:hasChanges="inserted"> <TrainCode>D7002</TrainCode> <FirstStation>深圳</FirstStation> <LastStation>广州</LastStation> <StartStation>深圳</StartStation> <StartTime>07:46:00</StartTime> <ArriveStation>广州</ArriveStation> <ArriveTime>09:20:00</ArriveTime> <KM>147</KM> <UseDate>01:34</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable137" msdata:rowOrder="136" diffgr:hasChanges="inserted"> <TrainCode>K9060\K9061</TrainCode> <FirstStation>深圳西</FirstStation> <LastStation>怀化</LastStation> <StartStation>深圳西</StartStation> <StartTime>19:08:00</StartTime> <ArriveStation>广州</ArriveStation> <ArriveTime>21:18:00</ArriveTime> <KM>162</KM> <UseDate>02:10</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable138" msdata:rowOrder="137" diffgr:hasChanges="inserted"> <TrainCode>K9064\K9065</TrainCode> <FirstStation>深圳西</FirstStation> <LastStation>铜仁</LastStation> <StartStation>深圳西</StartStation> <StartTime>11:20:00</StartTime> <ArriveStation>广州</ArriveStation> <ArriveTime>13:50:00</ArriveTime> <KM>162</KM> <UseDate>02:30</UseDate> </TimeTable> <TimeTable diffgr:id="TimeTable139" msdata:rowOrder="138" diffgr:hasChanges="inserted"> <TrainCode>K9076</TrainCode> <FirstStation>深圳东</FirstStation> <LastStation>常德</LastStation> <StartStation>深圳东</StartStation> <StartTime>19:05:00</StartTime> <ArriveStation>广州</ArriveStation> <ArriveTime>21:24:00</ArriveTime> <KM>139</KM> <UseDate>02:19</UseDate> </TimeTable> </getStationAndTime>
<getDetailInfo xmlns=""> <TrainDetailInfo diffgr:id="TrainDetailInfo1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> <TrainStation>广州(车次:D7001)</TrainStation> <ArriveTime/> <StartTime>06:03:00</StartTime> <KM>0</KM> </TrainDetailInfo> <TrainDetailInfo diffgr:id="TrainDetailInfo2" msdata:rowOrder="1" diffgr:hasChanges="inserted"> <TrainStation>广州东</TrainStation> <ArriveTime>06:13:00</ArriveTime> <StartTime>06:15:00</StartTime> <KM>8</KM> </TrainDetailInfo> <TrainDetailInfo diffgr:id="TrainDetailInfo3" msdata:rowOrder="2" diffgr:hasChanges="inserted"> <TrainStation>石龙</TrainStation> <ArriveTime>06:41:00</ArriveTime> <StartTime>06:43:00</StartTime> <KM>69</KM> </TrainDetailInfo> <TrainDetailInfo diffgr:id="TrainDetailInfo4" msdata:rowOrder="3" diffgr:hasChanges="inserted"> <TrainStation>常平</TrainStation> <ArriveTime>06:54:00</ArriveTime> <StartTime>06:56:00</StartTime> <KM>90</KM> </TrainDetailInfo> <TrainDetailInfo diffgr:id="TrainDetailInfo5" msdata:rowOrder="4" diffgr:hasChanges="inserted"> <TrainStation>樟木头</TrainStation> <ArriveTime>07:03:00</ArriveTime> <StartTime>07:05:00</StartTime> <KM>103</KM> </TrainDetailInfo> <TrainDetailInfo diffgr:id="TrainDetailInfo6" msdata:rowOrder="5" diffgr:hasChanges="inserted"> <TrainStation>深圳</TrainStation> <ArriveTime>07:34:00</ArriveTime> <StartTime/> <KM>147</KM> </TrainDetailInfo> </getDetailInfo>通过对以上几个接口的合理应用,我们就能通过调用这些接口,通过处理返回的XML数据,
==================================================================================================
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng
==================================================================================================