There is a specific code that sends a request to the server. I tried to test it in the SOAPUI program works, I try to reach the server through the application, the answer does not come.
private String login(String username, String password) { String xml = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("https://ololo"); httppost.setHeader("Accept-Encoding", "gzip, deflate"); httppost.setHeader("Content-Type", "text/xml; charset=utf-8"); httppost.setHeader("Host", "oooo"); httppost.setHeader("Expect", "100-continue"); httppost.setHeader("SOAPAction", "http://ololo"); String str = "<soapenv:Envelope \n" + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" \n" + "xmlns:mob=\"http://ololo">\n" + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + " <mob:Auth>\n" + " <!--Optional:-->\n" + " <mob:authRequisites>\n" + " <!--Optional:-->\n" + " <mob:Login>" + username + "</mob:Login>\n" + " <!--Optional:-->\n" + " <mob:Password>" + password + "</mob:Password>\n" + " </mob:authRequisites>\n" + " </mob:Auth>\n" + " </soapenv:Body>\n" + "</soapenv:Envelope>"; httppost.setEntity(new StringEntity(str)); HttpResponse response = httpclient.execute(httppost); xml = EntityUtils.toString(response.getEntity()/*,"UTF-8"*/); } catch (Exception e) { e.printStackTrace(); } return xml; } answer:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <AuthResponse xmlns="http://ololo"> <AuthResult> <ErrorCode>xxx</ErrorCode> <SessionID>00000000000000</SessionID> </AuthResult> </AuthResponse> </s:Body> </s:Envelope> Sample request via SOAPUI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mob="http://ololo"> <soapenv:Header/> <soapenv:Body> <mob:Auth> <!--Optional:--> <mob:authRequisites> <!--Optional:--> <mob:Login>xxx</mob:Login> <!--Optional:--> <mob:Password>xxx</mob:Password> </mob:authRequisites> </mob:Auth> </soapenv:Body> </soapenv:Envelope> Checked status:
String status = String.valueOf(response.getStatusLine()); в логах ответ такой: HTTP/1.1 404 Not Found