Problems parsing fields from multipart with GridForm / FormidableJS - android

I have an expressJS server running. I am POSTING multipart form-data to the server, and parsing this with GridForm (which again, correct me if I am wrong, is an extension of FormidableJS). This seems to work fine when posting from a web-form, or Postman etc., however, when I try to post from my Android app or IOS app, there is a strange issue. Sometimes it works fine, and then, even though I do no changes in the app code, no fields are parsed. The files are however allways parsed, so it is clear that the POST actually comes through. Anyone have any ideas of what this problem can be?

Related

React Native Fetch POST/PUT sends null value

been working on this one about a week already. So i'm using React Native's fetch method to access our API. Using the GET method works, means that i was able to get data in our API. The problem now is the POST and PUT methods, when using PUT to send data, the value passed is always a null value. I tried using console.log in chrome browser, the response is 200, so means its ok and it was able to talk to the API, the only this is that the value is sent is always a null value. Note also that manually updating the data using Postman works, only doesnt work when API is called from React Native. help will really help me continue my development since i'm really stuck with this one. Thanks a lot guys
See this file to see some code snippets
I also had this issue before and what I found out about the problem is:
Our server does not prepare api for "utf-8", and android avd sent requests with "charset=utf-8". So it will cause one of the platform showing error because the request charset is not same.
The issue is here and they still not fix it: https://github.com/facebook/react-native/issues/8237
Check the Content-type in the headers of your POST and PUT requests. Set it to application/json if your API takes parameters in JSON format.

Android form submission to ASP

Okay, weird, weird question time. I have an Android app that submits data to the server using a form POST to an ASP page. Well, at least it SHOULD. I actually have 2 domains. Let's say they are: MySite.com and MySiteBeta.com.
When I use the Android app and post to MySite.com the form data is received without any problems. When I modify the app to post to MySiteBeta.com the form data is not received. (No changes to the code except the domain name) Mind you, there are no errors recorded in the page - and execution continues past where any error should have occured. But, no form data is present. I'm looping through the Request.Form object just to be sure, and nothing is there. Also, if I just create another ASP page to send this form data, everything works fine. So, it doesn't seem to be anything with the ASP page itself.
What could cause an Android app to work when posting to one domain but not another? NOTE: The files on the server are the same. I'm assuming it may be some sort of permissions in the ASP setup (running IIS8)? Not sure.

Android: How can I POST json while loading the response in a WebView?

I have a page that will be loaded using a WebView, but it is expecting POSTed json in the request. Nothing I have found on POSTing data seems to make sense in terms of receiving HTML as a response.
Any help would be appreciated.
In particular, it seems using WebView#postUrl, I am stuck with the default content-type.
The WebView#loadData has some weird "you can't load resources from the network" clause if you use this approach.
Really, this seems surprising to me. Is it that strange of a request to want to POST some data when requesting a page? iOS does this with no problem.

Pulling data from web server on android not updating

Im not quite sure whether the problem is with my android program or its a some kind of limitation in the web server api. Im using futurerequest to get the data from xively with api key and feed id, and parsing the data in json format, then storing it in my db. The connection establishes just fine and im able to connect and get the data from the server. This is done through an asynctask and the request frequency is 1 min.
The issue im facing is that when i update the data in the server through web browser, the response on my program is not updated. It keeps getting the old data. When debugging i can clearly see that everything is working as intended, and i can see that the json response object i get from the server is working, however, the data is not fresh. I found out that by changing the api key manually makes the program get the newest data. Also by clearing the cache and data results in fetching the new data from the server. As you you know, i cant ask the user to clear his cache and data everytime to get the latest update.
How do i go about this issue? What might be the reason behind this problem? Thanks in advance!
Edit: Clearing the cache alone does not help. Also, using the phone instead of the emulator doesnt help either.
Im using volley library to handle the request/network traffic
Wanted to updated the solution that i found. This link helped me find the solution. Apparently, there is some caching involved by volley. By using the method
request.setShouldCache(false);
i was able to get the lasted updates from the server at all times.
However, when i tried to get the cache with the code below, before setting it to false, to see whats in the cache it was empty. entry would always be null. if someone know why and could explain i would be grateful :)
Entry entry = queue.getCache().get(url);
if(entry!=null){
String data = new String(entry.data, "UTF-8");
// process data
}

What would cause server to URLRequest corruption

I have an app on iphone and android that both fail periodically when calling the server. When I say that they fail I mean that I get no errors codes, 200 Connection code meaning that it was successful, but a corrupted string/data/(jsonObject/Array). I list all of those data types because depending on the app they use some or all of them. The information when printed out in sting form does have the return JSON coming from the server, but it is corrupted with extra code or text that will not allow JSONParsers to work properly. Like I said before it doesn't fail all the time and it only fails in what is in the returned string/json/data. I have been told before that I am connecting, receiving, and handling the information correctly and that I should look to the server. We have changed servers in the middle of this and it works faster but still has a similar fail rate. Also, the server does not fail or have issues with browsers. So, in all web browsers it throws no errors, doesn't corrupt the site and or the information that is displayed. So, if I get on my computer and go to the website I will see the correct information every time when I load the page. Any ideas would be greatly appreciated.
The answer that I found out for android was that it was the old server, but the new serve still had issues with the IOS app but I figured out that if you alloc the NSString with the NSData then the information will not have any possiblities of gaining extra data or information. So alloc works.

Categories

Resources