Sending an OPTIONS request in Android is not working - android

I am trying to send an OPTIONS request from my android application to my Windows 2008 Server webservice (which is a .net webservice). I am using SSL, and am having difficulty getting this to work. I really need to know exactly what my headers should look like. I know I don't send the body, I just need to know what to send. I really need an example not a link to someone just talking about some things.

I found the answer. It was working. I just wasnt looking in the right place for my response. I was looking at the final response that I get from my Soapbuilder class, and I am stripping out the headers before returning. I is actually giving the right options headers back.

Related

What I need for a successful GET request using retrofit android?

I'm trying to create my own application like an e-mail client. I use Retrofit library and I have already managed to create POST request for authorization via username and password. Maybe somebody can help me with structurising my general task(which classes I have to create or smth like that) because I can't create the strategy of its development. I'm a beginner in android development and also in retrofit library. When I first had made a POST request it was like a surprise because I didn't understand how it worked. So maybe somebody can advise me some tutorials or can explain from what I have to start for having s really successful GET request. I have some previous questions right here: Adding authorization header interface android retrofit. After some conversations with more professional developers, I have realized that I don't know where I have to begin. Thank you for your help.
I think This Tutorial is Good for you -> link

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.

Set up a server and get feed from it in android

This may not be the type of question I am supposed to ask here but I don't have anywhere else to go. I want to make an android application which gets feed from a web-server and displays in the application. It will be kind of a newspaper app. I have done my share of work: I know android application developemnt: have made some apps. Also, I have an idea of UI: a listview with the feeds and then on selecting an element I will open another activity with the complete feed. What I wanted to know is:
How to set-up a server for this?
How to request?
Can I set-up a free server?
I dont want to use GCM as I don't think it allows sending pictures. Plus it allows small data to be sent. Also, I have no knowledge about the 3rd party server I may need to create for this.
I would want to post both text and photos (combined makes a post, total of around 10 posts) from the server. Please dont close as not a question. Any link, tutorial will be highly appreciated. For server side coding, I know php, .net. I have never coded in java for a server, but I can learn it.
Please follow following steps to get your project done.
Set up any php or Java or .Net Server (If you are aware of any of these web technologies)
After you set up server you need to make web service which will work as mediator to transfer data between your server and mobile.
Webservice response will be either in JSON or XML
Generate response according to your need and parse them on android side.
Display in listview :) :)
You can use JBOSS for your server, and do a Java Server with Webservices.
In your webservices you'll have a service that get all the feeds, and maybe another that request the complete feed...
Your "language" between the Android app and the Server, you can use XML with SOAP (ksoap2 for Android), or you can try JSON (I never used, but I will 'cause we goona need use in my service).
You can try find another free server side, but I think the SOAP is important in most of the servers to "talk" with your app.
I hope helped you.
[]s
Bertan

How to make a POST request from inside a Restlet

I'm current using Restlet to interface with an Android app.
I want the Restlet on the server to then trigger a C2DM push message when it gets a certain POST from an Android app - it's basically just a simple HTTP POST to Google's servers with some extra values in it.
I imagine there must be some way of using the in built connector, or otherwise, anyone have any ideas? Can't seem to find anything about it on the net, an unusual request perhaps.
Edit: Probably should have expanded on this to begin with, the reason why I ask is that I'm trying to use Apache httpClient inside the restlet but I'm not able to to get it to work. If that is what you're supposed to do, then it's probably a different question altogether.
Use Java's native HttpURLConnection object: http://download.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html
Follow the implementation guidelines provided by Google: http://code.google.com/android/c2dm/#push
So what I was doing is the right way to do it after all, I've got Apache HttpClient set up and working in a seperate thread to do the push. For some reason it fails due to a peer exception (which is the exception I was getting initially), but I've got around that by automatically trusting the SSL certificate. Why that was happening with the C2DM address I really have no idea.

How to send html form using to https resource in Android?

I only want to send an html form by post method to a https resource from an Android activity.
I have (only for development and testing) an Lighttpd server with it own certificate to make handshaking, so there MUST happen authentication at least from server (client authentication is optional but desirable).
I have seen, lots of forums with different ways to make it, but I am a little confused, I do not know which could be the correct way to make it.
Please show me a chunk of code.
Thank you very very much.
Try out this tutorial, it shows GET, POST and Multipart POST request on the android platform
http://www.softwarepassion.com/android-series-get-post-and-multipart-post-requests/
I wrote some code to submit an HTML form to a server over https, which can be found in this answer. The version in the answer uses an HttpsUrlConnection, and the version in the question uses HttpClient. I could never quite get the right result from the server with the HttpClient version, but either approach should work in theory.

Categories

Resources