0

Ksoap パーサーを使用して SOAP 解析を行っているときに、サーバーから応答を取得しています。オブジェクトの属性から値を取得したいと考えています。

SoapObject obj = (SoapObject)envp.getResponse(); 
System.out.println("resultsString"+obj);

RIDalertsSummaryを取得したい場合の取得方法

resultsStringanyType{RID=201309201377618; alertDetailPopulated=true; alertsId=0; 
alertsSummary=anyType{}; destExpArrival=06:31; destSchArrival=06:30;
destinationStation=anyType{crsCode=BKJ; stationName=Beckenham Junction; }; 
expArrival=06:19; expDepart=06:20; otherAlertPresent=false; platformNo=3;
routeDetailPopulated=false; routeDetails=null; rsID=null; schArrival=06:19; 
schDepart=06:19; serviceAlertPresent=false; toc=SE; tocName=Southeastern; trainID=2M06; trainLastReportedAt=null; }
4

2 に答える 2

0
public void retrieveREsponsefromSoap(){   
  String METHOD_NAME = "GetAlldata";
  String SOAP_ACTION = "http://tempuri.org/1234.._Services/";
  SOAP_ACTION = SOAP_ACTION + METHOD_NAME;
  SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  String SoapResult = null;

   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                    SoapEnvelope.VER11);
            envelope.setOutputSoapObject(request);

            envelope.dotNet = true;

            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

            // this is the actual part that will call the webservice
            androidHttpTransport.call(SOAP_ACTION, envelope);

            // Get the SoapResult from the envelope body.
            if (envelope.bodyIn instanceof SoapFault) {
                SoapResult = ((SoapFault) envelope.bodyIn).faultstring;
            } else {
                SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
                SoapResult = resultsRequestSOAP.getProperty(0).toString();
            }

            Log.i(WebCalls, "Response " + SoapResult);
}
于 2013-09-20T05:30:32.100 に答える
0
// Get the SoapResult from the envelope body.
        if (envelope.bodyIn instanceof SoapFault) {
            SoapResult = ((SoapFault) envelope.bodyIn).faultstring;
        } else {
            SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
            SoapResult = resultsRequestSOAP.getProperty(0).toString();
        }

これがあなたに役立つことを願っています..

于 2013-09-20T05:33:39.707 に答える