What I'm trying to do is send my Android image to my web service, which is C #. On the Android side, I get no errors and no warnings, but I have nothing to show on the service, but in fact it does not receive the image at all.
I am still particularly new to services this way, so any help would be greatly appreciated!
My Android AsyncTask Looks Like This:
@Override protected String doInBackground(File... file) { String imageDescriptionTemp = "Photo Temp Description."; String PostRequestUri = "https://demo.relocationmw.com/ws_docmgmt/Service1.svc"; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(PostRequestUri); FileBody bin1 = new FileBody(file[0]); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("Image", bin1); post.setEntity(entity); HttpResponse response; try { response = client.execute(post); resEntity = response.getEntity(); final String response_string = EntityUtils.toString(resEntity); if(resEntity != null){ Log.i("RESPONSE", response_string); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
The fact that there simply calls the service file on the server sends an image and soon the description and thatβs all.
here is my c # utility code.
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Web; using System.Text; using System.IO; using System.Drawing; using System.Drawing.Imaging; using System.Xml;
This should take my file and return the XML with SUCCESS for me to register. Again, any help is much appreciated!
source share