如何在android中以Soap请求的形式发送字符串

如何在android中以Soap请求的形式发送字符串,android,web-services,Android,Web Services,字符串id=array1[位置] 如何在android中将此id作为soap请求发送 我在下面提到了webservice端编码……请帮助我 public string GetOutletID(string outlet) { xDoc.LoadXml("<PMS></PMS>"); XmlNode Root = xDoc.DocumentElement; XmlElement head = xD

字符串id=array1[位置]

如何在android中将此id作为soap请求发送

我在下面提到了webservice端编码……请帮助我

public string GetOutletID(string outlet)

 {
            xDoc.LoadXml("<PMS></PMS>");
            XmlNode Root = xDoc.DocumentElement;

            XmlElement head = xDoc.CreateElement("EMENU");
            Root.AppendChild(head);

            XmlElement dt = xDoc.CreateElement("DATETIME");
            dt.InnerText = Date;
            head.AppendChild(dt);

            elem = null;
            elem = xDoc.CreateElement("ID");
            elem.InnerText = "1";
            head.AppendChild(elem);

            elem = null;
            elem = xDoc.CreateElement("REQTYPE");
            elem.InnerText = "OUTLETID";
            head.AppendChild(elem);

            elem = null;
            elem = xDoc.CreateElement("OUTLETID");
            elem.InnerText = outlet;
            head.AppendChild(elem);
            return xDoc.InnerXml.ToString();

        }
公共字符串GetOutletID(字符串出口)
{
xDoc.LoadXml(“”);
XmlNode Root=xDoc.DocumentElement;
XmlElement head=xDoc.CreateElement(“EMENU”);
根。附属物(头);
XmlElement dt=xDoc.CreateElement(“日期时间”);
dt.InnerText=日期;
头、子(dt);
elem=null;
elem=xDoc.CreateElement(“ID”);
elem.InnerText=“1”;
头.附肢儿童(elem);
elem=null;
elem=xDoc.CreateElement(“REQTYPE”);
elem.InnerText=“OUTLETID”;
头.附肢儿童(elem);
elem=null;
elem=xDoc.CreateElement(“OUTLETID”);
elem.InnerText=出口;
头.附肢儿童(elem);
返回xDoc.InnerXml.ToString();
}

请参考此示例,这可能会有所帮助

public static final String SOAP_URL = "http://scrwash.com/WebService/MiWebService.asmx"; public static final String SOAP_NAMESPACE = "http://tempuri.org/";

public static final String SOAP_METHOD_RegisterUser = "RegisterWithPhone";
public static final String SOAP_ACTION_RegisterUser = SOAP_NAMESPACE+SOAP_METHOD_RegisterUser;

public String getmUserName() {
    return mUserName;
}

public void setmUserName(String mUserName) {
    this.mUserName = mUserName;
}

public String getmPassword() {
    return mPassword;
}

public void setmPassword(String mPassword) {
    this.mPassword = mPassword;
}

public String doRegisteration() throws Exception {

String doRegisterationReply = RegisterUser(this.getmUserName(),this.getmPassword());
System.out.println(doRegisterationReply);
return doRegisterationReply;

    }


public static String RegisterUser(String userName, String userPassword) {

        String responce = null;
        SoapObject request = new SoapObject(SOAP_NAMESPACE,
                SOAP_METHOD_RegisterUser);

        PropertyInfo mUserName = new PropertyInfo();
        PropertyInfo mUserPass = new PropertyInfo();

        String xChg = userName.replaceAll("-", "");
        System.out.println(xChg);
        mUserName.setName("phone"); // Element at SOAP
        mUserName.setValue(xChg);

        mUserPass.setName("password"); // Element at SOAP
        mUserPass.setValue(userPassword);

        request.addProperty(mUserName);
        request.addProperty(mUserPass);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        HttpTransportSE aht = new HttpTransportSE(SOAP_URL);
        try {
            aht.call(SOAP_ACTION_RegisterUser, envelope);
            SoapPrimitive LoginResult;
            LoginResult = (SoapPrimitive) envelope.getResponse();
            System.out.println("=================Register User Results: "
                    + LoginResult.toString());
            responce = LoginResult.toString();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        }

        return responce;
    }