Я использую следующий код для отправки SOAP-запроса.
String str = new StringBuilder("POST /WrenchTelLink/WrenchENTService.asmx HTTP/1.1\n")
.append("Host: 59.160.183.14\n")
.append("Content-Type: text/xml; charset=utf-8\n")
.append("Content-Length: LLLLLL\n")
.append("SOAPAction: \"http://WrenchGlobal/GetToDoList\"\n ")
.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
.append("<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-
instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n")
.append("<soap:Body>\n")
.append("<GetToDoList xmlns=\"http://WrenchGlobal/\">\n")
.append("<viPeriod>IIIIII</viPeriod>\n")
.append("<vsUserID>SSSSSS</vsUserID>\n")
.append("</GetToDoList>\n")
.append("</soap:Body>\n")
.append("</soap:Envelope>\n").toString();
String temp = str.replaceAll("LLLLLL",Integer.toString(str.length()))
.replaceAll("SSSSSS",ph).replaceAll("IIIIII",Integer.toString(period));
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
try
{
StringEntity se = new StringEntity(temp,HTTP.UTF_8);
se.setContentType("text/xml");
httppost.setHeader("Content-Type","application/soap+xml;charset=UTF-8");
httppost.setEntity(se);
BasicHttpResponse httpResponse = (BasicHttpResponse)httpclient.execute(httppost);
if(httpResponse.getStatusLine().toString()!="")
Toast.makeText(TelLinkActivity.this, httpResponse.getStatusLine().toString()
, Toast.LENGTH_SHORT).show();
else
Toast.makeText(TelLinkActivity.this,"Failed", Toast.LENGTH_SHORT).show();
}
catch(ClientProtocolException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
Не показывается ни одно из сообщений TOAST. Я не понимаю, что я должен понять из этого. Это не работает вообще. Может кто-нибудь сказать мне, если что-то не так с кодом ..?