Hi i am trying to connect android app with wcf service hosted in console win app
in local network this is how i call it in the url how i call it "http://192.168.1.3:9000/T_service" when i wanna call method of this service
http://192.168.1.3:9000/T_service/getData and gives me blank page.??? i dont know if this is ok
when i call it from .aspx file all is fine works perfect i tested it in aspx to make sure it works.
how i use it on android
SoapObject Reques = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Reques);
HttpTransportSE hts = new HttpTransportSE(URL);
try{
hts.call(SOAP_ACTTION, soapEnvelope);
SoapObject result = (SoapObject )soapEnvelope.getResponse();
result.getPropertyCount();
ArrayList<string> ar = new ArrayList<string>();
if(result.getPropertyCount() != 0){
for(int i = 0 ; i < result.getPropertyCount(); i++)
{
ar.add(result.getPropertyAsString(i));
}
}
else Toast.makeText(getApplicationContext(), "Pogresna lozinka!", Toast.LENGTH_LONG).show();
}catch(Exception er)
{
Toast.makeText(getApplicationContext(), er.toString(), Toast.LENGTH_LONG).show();
}
this code gives me error on this line hts.call(SOAP_ACTTION, soapEnvelope);
the error is = "java.io.IOException: HTTP request failed, HTTP status: 404"
i try one more code
try {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(EMPLOYEE_SERVICE_URI);
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
if(entity.getContentLength() != 0) {
Reader employeeReader = new InputStreamReader(response.getEntity().getContent());
char[] buffer = new char[(int) response.getEntity().getContentLength()];
employeeReader.read(buffer);
employeeReader.close();
JSONObject employee = new JSONObject(new String(buffer));
Toast.makeText(getApplicationContext(), employee.getString("1"), Toast.LENGTH_LONG).show();
}
but this gives me all ways empty result entity.getContentLength() is 0
can some one help me with code tutorial or somethink else ???