2016-10-14 110 views
1

我是Android開發新手,我面臨一個消耗xml的問題,它很複雜。任何人都可以幫我一把嗎?如何寫httpTransportSEKsoap複雜類型

下面

是XML

1. <soapenv:Envelope 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:lis="ListaDetalhe"> <soapenv:Header/> <soapenv:Body> 
      <lis:ListaDetalhe soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
      <Autenticacao xsi:type="urn:Autenticacao" xmlns:urn="urn:RouterBoxMobile"> 
       <ChaveIntegracao xsi:type="xsd:string"></ChaveIntegracao> 
      </Autenticacao> 
      <tlDadosTitulosDetalhe xsi:type="urn:tlDadosTitulosDetalhe" xmlns:urn="urn:RouterBoxMobile"> 
       <ID_Titulo xsi:type="xsd:int">1</ID_Titulo> 
      </tlDadosTitulosDetalhe> 
      </lis:ListaDetalhe> </soapenv:Body> </soapenv:Envelope> 

回答

0

我設法解決大量的研究後,問題, 下面的代碼:

private void listaDetalhes(){ 


     SoapObject request = new SoapObject("urn:RouterBoxMobile","ListaDetalhe"); 


     SoapObject chaveIntegracao = new SoapObject("urn:RouterBoxMobile","ListaDetalhe"); 

     chaveIntegracao.addProperty("ChaveIntegracao","##########"); 
     request.addProperty("Autenticacao",chaveIntegracao); 


     SoapObject tlDadosTitulosDetalhe = new SoapObject("urn:RouterBoxMobile","ListaDetalhe"); 
     SoapObject idTitulo = new SoapObject("urn:RouterBoxMobile","ListaDetalhe"); 

     idTitulo.addProperty("ID_Titulo",1); 
     tlDadosTitulosDetalhe.addProperty("tlDadosTitulosDetalhe" ,idTitulo); 

     request.addProperty("tlDadosTitulosDetalhe",idTitulo); 

     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
       SoapEnvelope.VER11); 




     envelope.setOutputSoapObject(request); 





     Log.i("Testando web Service",""); 
     String url="####################################################"; 

     HttpTransportSE httpTransport = new HttpTransportSE(url); 
     httpTransport.debug = true; 






     try { 


      httpTransport.call("",envelope); 

      Log.i("Request",httpTransport.requestDump.toString()); 
      SoapPrimitive msg = (SoapPrimitive)envelope.getResponse(); 

      Log.d("RouterBox", "Detalhes: " + msg); 
     } catch (IOException e) { 
      e.printStackTrace(); 
     } catch (XmlPullParserException e) { 
      e.printStackTrace(); 
     } 
    }