Receive POST information from callback, Android WebView - android

My scenario is this: we point the user to a form where they fill in the data (3DSecure) and then POST, the website then POSTS the response to a callback URL - this response is what I want to capture. WebView.shouldInterceptRequest() can get the headers but not the content (Why, Google?). I tried this link and it can get the POST data that the user sends. Is there any way to use Javascript to catch the POST data being received to a callback of my choosing?
I saw this post from 5 years ago and the man resorted to POSTing the response back to a server and then getting the contents from the phone. This is far from ideal. Surely there's a newer solution?
shouldInterceptRequest() mentions that a response contains the "response information or null if the WebView should load the resource itself", how do I get it so that the WebView shouldn't load the resource itself? The source code seems to return null always.

I used this gentleman's library: https://github.com/LivotovLabs/3DSView
If one was looking to do this with something other than 3DSecure they could use it as a template.

Related

How to read body of a POST request into Android WebView

I have to submit a form to an external URL, that provides into my WebView a series of interaction with the user.
At the end of this process this external service does a redirect to my another URL (that is fake) through a POST call, sending some data that I need to show at the user.
I tried to catch this POST request into the method shouldInterceptRequest, because I have to read data before the load of my fake url starts, but the methods that I can use on a WebResourceRequest object are useless. There is nothing to read the body of this request.
There is another way to catch my data? Any suggestions?
(I already tried the writeinterception project library, but it doesn't work.)
Thanks a lot in advance.

Android HTTP Post upload image in webview session

I've been reading for more than three days about this and my head is totally messed up. I saw too much code.. Plaase help!
I have an application with a webview. In this webview I am logged in an account. So this means that when I get to the upload part I must use the webview session. I didn't understand very clear how to work with cookies. Also in the uploader I must set the Content-type and the Content-Disposition.
So my question is: Would you give me an example all this things? Getting the cookies, setting them to the http post request and setting the cookies so I can send the image. Thanks!

Http Request doesn't give correct response

I'm trying to make a http request and get the full page as string.
After I got response, I'm trying to find the position of a substring in it.
But I can't find that substring in the response whereas the original web page contains that substring in Google Chrome -> View Source. (Checked in mobile version).
So, my guesses are:
1) Maybe It's not requesting the mobile version of that web page? If it is so, how can I change my user agent to a mobile version? like chrome android?
2) Is it possible that response does not give me the full page? Because, when I try, LogCat isn't showing the full page.
Thanks.
Try this
1) http://www.intertech.com/Blog/android-defaulthttpclientandroidhttpclient-and-httpparams/ this will help you for changing user agent.
2) for logging try to log your response like Log.d("Reponse is: ", response);
1) Yes you can set the user agent by creating your client like this:
HttpClient client = AndroidHttpClient.newInstance("MyAppUserAgent/1.0");
2) You would need to post the code, but logcat will not necessarily dump the entire response. There is maximum length per log and text is clipped to that length.

Android: Fail to retrieving a tag value of the EWS response

I am hitting my Exchange server using (EWS+Basic Authentication). I could authenticate and hit my services with these Request GetItem (E-mail Message),SyncFolderItems and few other and getting the response successfully. I could parse the SyncFolderItems response to get basic info abt the Mail Items (Like Subject,To,From,HasAttachments etc.). But when i hit the GetItem request i am receiving a response but i couldnt get the Mail item Body (i.e, the Message). Is it any tutorial to do this. I am using XMLPullParser..
The response might be look like this . Plz guide me on this
I've used JWebServices for Exchange (Android version) several times. It's not free but accomplished what I needed. You should try the API to see if they get correct Body to see if your application fails or body is empty.
Thanks for ur valuable replies.. I found the data (values) that i stored from the saxparser is not complete. So only i couldnt get the html content properly in the webview.
i used the following link as reference and used the string buffer to resolve this issue.
Thx

How can I get post back response using webview in android?

Currently I am working on payment integration for native android app after send the request it have given me post back url with some attributes as success/fail response. I can't understand that how can I get those post back url attributes values using WebView . If any one know,
Please suggest me some idea for that.

Categories

Resources