hello, i have a task to create a client for android that can add remotely
entries to www blog. I came across problem in using HTTP post request.
whenever i call it i get in response the HTML code of the site i am
requesting. ( Site contains form with textfields i will describe bellow)
html of site:
<div id="insertA">
<form class="MultiFile-intercepted" enctype="multipart/form-data"
method="post" onsubmit="return checkAnomalyFields();"
action="dodajN.html">
<table style="border-weight: 0px">
<tbody>
<tr>
<tr>
<td id="wybory"><select id="typ" onchange="typeSelected()"
size="1"
name="typuId">
</td>
<td>
</tr>
<tr>
<td>Szerokość: <input id="szer" type="text"
onchange="setMarker()"
value="" name="szer">
<div id="szerErr" class="err">Proszę podać szerokość na
terenie
Polski (49-55).</div>
</td>
<td>Długość: <input id="dlug" type="text"
onchange="setMarker()"
value="" name="dlug">
<div id="dlugErr" class="err">Proszę podać długość na
terenie
Polski (14-25).</div> <input id="id" type="hidden"
value=""
name="id">
</td>
</tr>
and java code i am using to handle request
try {
HttpClient client = new MyHttpClient(Send.this);
String postURL = "url";
HttpPost post = new HttpPost(postURL);
//FileBody bin = new FileBody(file);
MultipartEntity reqEntity = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
//reqEntity.addPart("myFile", bin);
reqEntity.addPart("typuId", new StringBody("1"));
reqEntity.addPart("statusuId", new StringBody("2"));
reqEntity.addPart("szer", new StringBody("52.321911"));
reqEntity.addPart("dlug", new StringBody("19.464111000000003"));
reqEntity.addPart("opis", new StringBody("jakis opis"));
post.setEntity(reqEntity);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
AlertDialog.Builder alert=new AlertDialog.Builder(Send.this);
alert.setTitle("Niepoprawne
dane").setMessage(EntityUtils.toString(resEntity)).setNeutralButton("OK",
null).show();
if (resEntity != null) {
Log.i("RESPONSE",EntityUtils.toString(resEntity));
}
} catch (Exception e) {
e.printStackTrace();
}
url i am calling is: someblog.com/blog.jsp?action=new or
someblog.com/blog.jsp?action="dodajN.html" no difference.
does anyone have an idea what i am doing wrong?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en