Android 2 soap调用使用同一类

Android 2 soap调用使用同一类,android,web-services,soap,Android,Web Services,Soap,我必须在一个类中使用两个soap调用url。 我的代码是: 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"; p

我必须在一个类中使用两个soap调用url。 我的代码是:

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();
    }

   }
  }
public类Orderinfo扩展活动{
私有静态最终字符串SOAP_ACTION=”http://xcart.com/data";
私有静态最终字符串方法\u NAME=“data”;
私有静态最终字符串命名空间=”http://xcart.com";
私有静态最终字符串URL=”http://192.168.1.168:8085/XcartLogin/services/RetailerWs?wsdl";
私有静态最终字符串URL1=”http://192.168.1.168:8085/XcartLogin/services/TodayC?wsdl";
/**在首次创建活动时调用*/
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.table);
SoapObject请求=新的SoapObject(名称空间、方法名称);
SoapSerializationEnvelope=新的SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(请求);
HttpTransportSE ht=新的HttpTransportSE(URL);
试一试{
ht.呼叫(SOAP_动作、信封);
SoapPrimitive响应=(SoapPrimitive)信封.getResponse();
SOAPs=响应;
字符串str=s.toString();
String resultArr[]=str.split(&);//结果字符串将拆分并存储在数组中
TextView tv=(TextView)findViewById(R.id.textView44);
//TextView tv=新的TextView(此);

对于(int i=0;i您在两次调用中都使用了一个evelope作为请求,所谓的服务方法和参数是相同的

是正确的…谢谢..谢谢您的帮助…dis是基本错误..我从您那里学到了dis基本信息。谢谢。我收到了输出。