在Android的工作室使用KSOAP非法财物错误

问题描述 投票:0回答:1

我试图使用KSOAP库检索一些公共汽车站的数据。以下是有关我试图发出请求的一些细节.. details

每当我试图让生成的响应我收到以下错误;

java.lang.RuntimeException: illegal property: GetRealTimeStopDataResult

这是我在检索RealTimeResult尝试:

class CallWebService extends AsyncTask<String, Void, String> {
    @Override
    protected void onPostExecute(String s) {
        text.setText("Bus = " + s);
    }

    @Override
    protected String doInBackground(String... params) {
        SoapObject result;
        int i = 999;
        String resString = "";
        SoapObject soapObject = new SoapObject(NAMESPACE, METHOD_NAME);

        PropertyInfo propertyInfo = new PropertyInfo();
        propertyInfo.setName(PARAMETER_NAME1);
        propertyInfo.setValue(params[0]);
        propertyInfo.setType(String.class);

        PropertyInfo propertyInfo1 = new PropertyInfo();
        propertyInfo1.setName(PARAMETER_NAME2);
        propertyInfo1.setValue("true");
        propertyInfo1.setType(String.class);

        soapObject.addProperty(propertyInfo);
        soapObject.addProperty(propertyInfo1);

        SoapSerializationEnvelope envelope =  new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(soapObject);

        HttpTransportSE httpTransportSE = new HttpTransportSE(URL);

        try {
            httpTransportSE.call(SOAP_ACTION, envelope);
            SoapObject soapPrimitive = (SoapObject) envelope.bodyIn;
            SoapObject body = (SoapObject) soapPrimitive.getProperty(0);
            resString = body.getProperty("GetRealTimeStopDataResult").toString();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return resString;
    }

引用的变量;

String URL = "http://rtpi.dublinbus.ie/DublinBusRTPIService.asmx?WSDL";
String NAMESPACE = "http://dublinbus.ie/";
String SOAP_ACTION = "http://dublinbus.ie/GetRealTimeStopData";
String METHOD_NAME = "GetRealTimeStopData";
String PARAMETER_NAME1 = "stopId";
String PARAMETER_NAME2 = "forceRefresh";

编辑:日志body.toString()显示:

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{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; element=anyType{}; }; }; }; }; }; }; }; diffgram=anyType{DocumentElement=anyType{StopData=anyType{ServiceDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; ServiceDelivery_ProducerRef=bac; ServiceDelivery_Status=true; ServiceDelivery_MoreData=false; StopMonitoringDelivery_Version=1.0; StopMonitoringDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; StopMonitoringDelivery_RequestMessageRef=anyType{}; MonitoredStopVisit_RecordedAtTime=2019-02-06T21:14:18.243+00:00; MonitoredStopVisit_MonitoringRef=4903; MonitoredVehicleJourney_LineRef=39; MonitoredVehicleJourney_DirectionRef=Inbound; FramedVehicleJourneyRef_DataFrameRef=2019-02-06; FramedVehicleJourneyRef_DatedVehicleJourneyRef=696; MonitoredVehicleJourney_PublishedLineName=39; MonitoredVehicleJourney_OperatorRef=bac; MonitoredVehicleJourney_DestinationRef=7339; MonitoredVehicleJourney_DestinationName=Burlington Road via Blanchardstown S.C.; MonitoredVehicleJourney_Monitored=true; MonitoredVehicleJourney_InCongestion=false; MonitoredVehicleJourney_BlockRef=39015; MonitoredVehicleJourney_VehicleRef=33598; MonitoredCall_VisitNumber=34; MonitoredCall_VehicleAtStop=false; MonitoredCall_AimedArrivalTime=2019-02-06T21:18:26+00:00; MonitoredCall_ExpectedArrivalTime=2019-02-06T21:18:26+00:00; MonitoredCall_AimedDepartureTime=2019-02-06T21:18:26+00:00; MonitoredCall_ExpectedDepartureTime=2019-02-06T21:18:26+00:00; Timestamp=2019-02-06T21:14:18.567+00:00; LineNote=anyType{}; }; StopData=anyType{ServiceDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; ServiceDelivery_ProducerRef=bac; ServiceDelivery_Status=true; ServiceDelivery_MoreData=false; StopMonitoringDelivery_Version=1.0; StopMonitoringDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; StopMonitoringDelivery_RequestMessageRef=anyType{}; MonitoredStopVisit_RecordedAtTime=2019-02-06T21:14:18.243+00:00; MonitoredStopVisit_MonitoringRef=4903; MonitoredVehicleJourney_LineRef=37; MonitoredVehicleJourney_DirectionRef=Inbound; FramedVehicleJourneyRef_DataFrameRef=2019-02-06; FramedVehicleJourneyRef_DatedVehicleJourneyRef=3984; MonitoredVehicleJourney_PublishedLineName=37; MonitoredVehicleJourney_OperatorRef=bac; MonitoredVehicleJourney_DestinationRef=7340; MonitoredVehicleJourney_DestinationName=Wilton Terrace via Castleknock; MonitoredVehicleJourney_Monitored=true; MonitoredVehicleJourney_InCongestion=false; MonitoredVehicleJourney_BlockRef=37008; MonitoredVehicleJourney_VehicleRef=44253; MonitoredCall_VisitNumber=4; MonitoredCall_VehicleAtStop=false; MonitoredCall_AimedArrivalTime=2019-02-06T21:32:53+00:00; MonitoredCall_ExpectedArrivalTime=2019-02-06T21:32:53+00:00; MonitoredCall_AimedDepartureTime=2019-02-06T21:32:53+00:00; MonitoredCall_ExpectedDepartureTime=2019-02-06T21:32:53+00:00; Timestamp=2019-02-06T21:14:18.583+00:00; LineNote=anyType{}; }; StopData=anyType{ServiceDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; ServiceDelivery_ProducerRef=bac; ServiceDelivery_Status=true; ServiceDelivery_MoreData=false; StopMonitoringDelivery_Version=1.0; StopMonitoringDelivery_ResponseTimestamp=2019-02-06T21:14:18.243+00:00; StopMonitoringDelivery_RequestMessageRef=anyType{}; MonitoredStopVisit_RecordedAtTime=2019-02-06T21:14:18.243+00:00; MonitoredStopVisit_MonitoringRef=4903; MonitoredVehicleJourney_LineRef=39; MonitoredVehicleJourney_DirectionRef=Inbound; FramedVehicleJourneyRef_DataFrameRef=2019-02-06; FramedVehic
java android soap android-ksoap2
1个回答
0
投票

您应该加载/转换WSDLhttp://rtpi.dublinbus.ie/DublinBusRTPIService.asmx?WSDL第一(这是不是终点URL,喜爱你的代码把它),以便有针对SOAP响应等级;泛型类不建议同时有可用的WDSL文件(这的确是一个东西应该感谢的,因为它准确地描述Web服务消费)。例如用wsdl2ksoapSoapUI。也看到了android-ksoap2标签,我已经加入。

http://rtpi.dublinbus.ie/DublinBusRTPIService.asmx似乎是终点,

没有?WSDL ......否则你可以张贴任何你想要的,总是会得到WSDL

screenshot

产生这些类:

http://rtpi.dublinbus.ie/DublinBusRTPIService.asmx?WSDL
Service Name: DublinBusRTPIService
Element Class: TestService Properties: 0
Element Class: TestServiceResponse Properties: 1
Element Class: GetRealTimeStopData Properties: 2
Element Class: GetRealTimeStopDataResponse Properties: 1
Element Class: GetRealTimeStopDataResult Properties: 0
Element Class: GetRealTimeStopData_ForceLineNoteVisit Properties: 3
Element Class: GetRealTimeStopData_ForceLineNoteVisitResponse Properties: 1
Element Class: GetRealTimeStopData_ForceLineNoteVisitResult Properties: 0
Element Class: GetRoutes Properties: 1
Element Class: GetRoutesResponse Properties: 1
Element Class: GetRoutesIncNiteLink Properties: 1
Element Class: GetRoutesIncNiteLinkResponse Properties: 1
Element Class: GetRoutesIncNiteLink_MobileFareCalc Properties: 1
Element Class: GetRoutesIncNiteLink_MobileFareCalcResponse Properties: 1
Element Class: GetDestinations Properties: 1
Element Class: GetDestinationsResponse Properties: 1
Element Class: GetAllDestinations Properties: 0
Element Class: GetAllDestinationsResponse Properties: 1
Element Class: GetStopDataByAddress Properties: 1
Element Class: GetStopDataByAddressResponse Properties: 1
Element Class: GetStopDataByAddressResult Properties: 0
Element Class: GetStopDataByRouteAndDirection Properties: 2
Element Class: GetStopDataByRouteAndDirectionResponse Properties: 1
Element Class: GetStopDataByRouteAndDirectionResult Properties: 0
Element Class: GetStopDataByRouteAndDirection_MobileFareCalc Properties: 2
Element Class: GetStopDataByRouteAndDirection_MobileFareCalcResponse Properties: 1
Element Class: GetStopDataByRouteAndDirection_MobileFareCalcResult Properties: 0
Element Class: GetStopDataByRoute Properties: 1
Element Class: GetStopDataByRouteResponse Properties: 2
Element Class: GetStopDataByRouteResult Properties: 1
Element Class: GetRoutesServicedByStopNumber Properties: 1
Element Class: GetRoutesServicedByStopNumberResponse Properties: 1
Element Class: StartTimer Properties: 0
Element Class: StartTimerResponse Properties: 1
Element Class: StopTimer Properties: 0
Element Class: StopTimerResponse Properties: 1
Element Class: GetCurrentSettings Properties: 0
Element Class: GetCurrentSettingsResponse Properties: 1
Element Class: SetCurrentSettings Properties: 1
Element Class: SetCurrentSettingsResponse Properties: 0
Element Class: postXMLData Properties: 2
Element Class: postXMLDataResponse Properties: 1
Element Class: ClearCacheItem Properties: 1
Element Class: ClearCacheItemResponse Properties: 1
SuperClass: BaseObject
Complex Type: RoutesResponse Properties: 1
SuperClass: BaseObject
Complex Type: ArrayOfRoute Properties: 1
SuperClass: BaseObject
Complex Type: Route Properties: 19
SuperClass: BaseObject
Complex Type: Destination Properties: 6
SuperClass: BaseObject
Complex Type: DestinationsResponse Properties: 1
SuperClass: BaseObject
Complex Type: ArrayOfDestination Properties: 1
SuperClass: BaseObject
Complex Type: ArrayOfString Properties: 1
Class Count: 44
Complex Types: 7
Woohoo
© www.soinside.com 2019 - 2024. All rights reserved.