2012-08-02 57 views
0

我必須使用2肥皂呼叫網址是在一個類中使用。 我的代碼是:2肥皂呼叫是使用相同的類

public class Orderinfo extends Activity { 
private static final String SOAP_ACTION = "http://xcart.com/data"; 
private static final String METHOD_NAME = "data"; 
private static final String NAMESPACE = "http://xcart.com"; 
private static final String URL = "http://192.168.1.168:8085/XcartLogin/services/RetailerWs?wsdl"; 
private static final String URL1 = "http://192.168.1.168:8085/XcartLogin/services/TodayC?wsdl"; 

/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.table); 
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 

    envelope.setOutputSoapObject(request); 

    HttpTransportSE ht = new HttpTransportSE(URL); 

    try { 
     ht.call(SOAP_ACTION, envelope); 
     SoapPrimitive response = (SoapPrimitive)envelope.getResponse(); 
     SoapPrimitive s = response; 
     String str = s.toString(); 
     String resultArr[] = str.split("&");//Result string will split & store in an array 
     TextView tv = (TextView) findViewById(R.id.textView44); 
     // TextView tv = new TextView(this); 

     for(int i = 0; i<resultArr.length;i++){ 
     tv.append(resultArr[i]+"\n\n"); 
     } 


     } catch (Exception e) { 
     e.printStackTrace(); 
     } 
    HttpTransportSE ht1 = new HttpTransportSE(URL1); 

    try { 
     ht.call(SOAP_ACTION, envelope); 
     SoapPrimitive response = (SoapPrimitive)envelope.getResponse(); 
     SoapPrimitive s = response; 
     String str = s.toString(); 
     String resultArr[] = str.split("&");//Result string will split & store in an array 
     TextView tv = (TextView) findViewById(R.id.textView43); 
     // TextView tv = new TextView(this); 

     for(int i = 0; i<resultArr.length;i++){ 
     tv.append(resultArr[i]+"\n\n"); 
     } 


    } catch (Exception e) { 
     e.printStackTrace(); 
    } 

    } 
    } 

這裏不得不首先顯示SOAP調用輸出爲3,第二SOAP調用輸出2.but兩者都顯示2 only.why什麼異常here.please幫助我。

回答

0

你已經在這兩個調用中使用一個evelope的要求,所謂的服務方法,而params是相同的

+0

雅的正確... thanks..thanks烏拉圭回合的幫助...... DIS是基本mistake..i已經從你那裏學到了基本的信息。謝謝你,我得到了我的輸出。 – user1570318 2012-08-02 07:13:18