2017-02-21 24 views
0

Как получить правильный ответ в приложении для Android. Мой апи оригинальный ответ дисплей в программном обеспечении SoapUIМыло api с ksoap

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<soap:Body> 
    <GetSourcesResponse xmlns="..."> 
    <GetSourcesResult> 
     <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 
      <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="ITS" msdata:UseCurrentLocale="true"> 
       <xs:complexType> 
       <xs:choice minOccurs="0" maxOccurs="unbounded"> 
        <xs:element name="ITS"> 
         <xs:complexType> 
          <xs:sequence> 
          <xs:element name="CM_CityID" type="xs:int" minOccurs="0"/> 
          <xs:element name="CM_CityName" type="xs:string" minOccurs="0"/> 
          </xs:sequence> 
         </xs:complexType> 
        </xs:element> 
       </xs:choice> 
       </xs:complexType> 
      </xs:element> 
     </xs:schema> 
     <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> 
      <DocumentElement xmlns=""> 
       <ITS diffgr:id="ITS1" msdata:rowOrder="0" diffgr:hasChanges="inserted"> 
       <CM_CityID>645</CM_CityID> 
       <CM_CityName>Ahmednagar</CM_CityName> 
       </ITS> 
       <ITS diffgr:id="ITS2" msdata:rowOrder="1" diffgr:hasChanges="inserted"> 
       <CM_CityID>2762</CM_CityID> 
       <CM_CityName>Airoli</CM_CityName> 
       </ITS> 
      </DocumentElement> 
     </diffgr:diffgram> 
    </GetSourcesResult> 
    </GetSourcesResponse> 

и я называю этот API, чтобы получить ответ, как

getResponse 
{ 
    getResponseResult=anyType 
    { 
    schema=anyType 
    { 
     element=anyType 
     { 
     complexType=anyType 
     { 
      choice=anyType 
      { 
      element=anyType 
      { 
       complexType=anyType 
       { 
       sequence=anyType 
       { 
        element=anyType{}; 
        element=anyType{}; 
       }; 
       }; 
      }; 
      }; 
     }; 
     }; 
    }; 
    diffgram=anyType{}; 
    }; 
} 

как получить правильный ответ оригинальный плз помогите мне ... ..управления заранее

ответ

0

Использование Wsdl2Codetool

Это веб-инструмент, который помогает разработчикам потреблять интернет-сервисы .net.

  1. Open выше schemas в browser Сохранить как .wsdl расширение
  2. Загрузить file.wsdl в Wsdl2Code
  3. Скачать Auto сгенерированный код
  4. Вставить в пакете
  5. Используйте Service класс для чтения, записи и Обновление с сервера

Код образца

public VectorClass ReadMultiple(VectorClass filter, 
     String bookmarkKey, int setSize, List<HeaderProperty> headers) { 
    SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
      SoapEnvelope.VER11); 
    soapEnvelope.implicitTypes = true; 
    soapEnvelope.dotNet = true; 
    SoapObject soapReq = new SoapObject(
      "urn:microsoft-dynamics-schemas/page/classsName", 
      "ReadMultiple"); 
    for (int i = 0; i < filter.size(); i++) { 
     soapReq.addProperty("filter", getSOAPVector(filter, i)); 
    } 
    // soapReq.addProperty("filter", filter); 
    soapReq.addProperty("bookmarkKey", bookmarkKey); 
    soapReq.addProperty("setSize", setSize); 
    soapEnvelope.setOutputSoapObject(soapReq); 
    NtlmTransport ntml = new NtlmTransport(url, 
      SharedPreferenceUtil.getString("userName", "username"), 
      SharedPreferenceUtil.getString("passWord", "password"), 
      SharedPreferenceUtil.getString("domainName", "domainname"), 
      SystemService.domainName); 
    try { 
     if (headers != null) { 
      ntml.call(
        "urn:microsoft-dynamics-schemas/page/className/ReadMultiple", 
        soapEnvelope, headers); 
     } else { 
      ntml.call(
        "urn:microsoft-dynamics-schemas/page/className/ReadMultiple", 
        soapEnvelope); 
     } 
     Object retObj = soapEnvelope.bodyIn; 
     if (retObj instanceof SoapFault) { 
      SoapFault fault = (SoapFault) retObj; 
      Log.e("Fault", "" + fault); 
      Exception ex = new Exception(fault.faultstring); 
      if (eventHandler != null) 
       eventHandler.Wsdl2CodeFinishedWithException(ex); 
     } else { 
      SoapObject result = (SoapObject) retObj; //Soap success response 
      if (result.getPropertyCount() > 0) { 
       Object obj = result.getProperty(0); 
       SoapObject j = (SoapObject) obj; 
       Log.e("Navpos Header Response", ""+result); 
       VectorClassName resultVariable = new VectorClassName(
         j); 

       return resultVariable; 
      } 
     } 
    } catch (Exception e) { 
     if (eventHandler != null) 
      eventHandler.Wsdl2CodeFinishedWithException(e); 
     e.printStackTrace(); 
    } 
    return null; 
} 
+0

Как это относится к проблеме ОП? – Rao

+0

это адресация 'как получить правильный ответ в Android-приложении' –

 Смежные вопросы

  • Нет связанных вопросов^_^