80,350
社区成员
发帖
与我相关
我的任务
分享
org.xmlpull.v1.XmlPullParserException: expected: START_TAG
{http://www.w3.org/2001/12/soap-envelope}
Envelope (position:START_TAG <{http://schemas.xmlsoap.org/soap/envelope/}
soap:Envelope>@1:208 in java.io.InputStreamReader@c4b0077)
import android.util.Log;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
/**
* Created by ZSpirytus on 2017/11/3.
*/
public class WebServiceConnector {
private static final String TAG = "WebServiceConnector";
private static final String WSDL_URI = "http://39.***.***.***:8080/?wsdl";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String METHOD_GETBASICINFOBYSNO = "getBasicInfoBySno";
private static final String PARAM_SNO = "Sno";
private static final String SOAPACTION = NAMESPACE+METHOD_GETBASICINFOBYSNO;
public static String[] getBasicInfoBySno(String sno){
SoapObject request = new SoapObject(NAMESPACE, METHOD_GETBASICINFOBYSNO);
request.addProperty(PARAM_SNO ,sno);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapSerializationEnvelope.VER12);
envelope.bodyOut = request;
envelope.dotNet = true;
try{
HttpTransportSE httpTransportSE = new HttpTransportSE(WSDL_URI);
httpTransportSE.call(SOAPACTION, envelope);
}catch (XmlPullParserException xmle){
Log.d(TAG,"Class: GetStudentBasicInfoBySno catch an XmlPullParserException!");
xmle.printStackTrace();
}catch (IOException ie){
ie.printStackTrace();
}
SoapObject object = (SoapObject) envelope.bodyIn;
String[] result = new String[6];
for(int i = 0;i<result.length;i++){
result[i] = object.getProperty("getBasicInfoBySnoResult").toString();
}
return result;
}
import android.os.AsyncTask;
import android.util.Log;
/**
* Created by ZSpirytus on 2017/11/4.
*/
public class GetStudentBasicInfoBySno extends AsyncTask<String, Integer, String[]> {
private static final String TAG = "GetStudentBasicInfoBySn";
private String[] aaa = new String[6];
@Override
protected String[] doInBackground(String... params) {
try {
String[] result = WebServiceConnector.getBasicInfoBySno("15251102222");
return result;
} catch (Exception e) {
e.printStackTrace();
Log.d(TAG,"Class: GetStudentBasicInfoBySno catch an Exception!");
return null;
}
}
@Override
protected void onPostExecute(String[] result) {
aaa = result;
}
public String[] getResult(){
return aaa;
}
}