> The local host URL ( on port 8000 ) is working great in the web browser. And the client is also supporting basic Internet connectivity.> By "connect" we meant that we were trying to connect the Sahana server through the ODK Collect Client by configuring its server's IP address to "127.0.0.1:8000" to generate forms. Since both the client and the server are in same network, we assumed that it should be able to identify Sahana server and respond, but it could not connect to the above address.
This seems like a basic TCP/IP networking issue then?
I suspect that the Android emulator's concept of 127.0.0.1 is
different to that for the host PC.
I don't know if it is possible to work around that - you'd need to
research within the Android emulator community (& pls report back any findings to the Eden Wiki).
Alternatively, you could put the Eden instance onto a Public IP & thus access from the Emulator like that...
We tried to deploy sahana server on to a public IP ( http://152.46.20.206:8000/ --> It should still be up and running )
and connect it from Sahana ODK client.We were able to get past the connection and no error was shown. We are able to access this even from the browser on the emulator.We could not however get any forms as we assume the database isnt setup yet.
Are there anything explicit steps to get this done ? We saw there a bunch of .table files in database folder and we were figuring a way as to run them.
I assume our next activity would be to get the current forms to work, and see if submission of them works. We can then move on to the customizations on them.
I'm not surprised that there are still issues as this is very old code - this is what your project is for :)
'Sahana ODK Collect'?
> Also when we tried "Start New Form" for the other forms which were > downloaded, Sahana odk collect crashed
If you're talking about one of the previous forks of ODK which
students have worked on then they are old/unmaintained ...
I would start with the normal trunk ODK.
* Engage with the ODK community
the best stable version of the ODK client to use
> 2. When we downloaded them, it gave the following error -
> org.javarosa.xform.parse.XFormParseException : XML Syntax error
* Fix any bugs in the Eden Python code ...
- using Eclipse to set Breakpoints is highly-advised:
http://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Eclipse
> Also is it possible to have a short call / audio chat to make us understand the flow ( form generation using xforms.py )
Understanding this code requires understanding Web2Py models & validators, so reading the web2py book is recommended:
http://web2py.com/book
We tried this link - "http://156.46.20.206:8000/eden/xforms/submission" from the browser and it also redirected us to the login page.
We have been trying to create an account on the Sahana Eden server so that we could use the login credentials to bypass the authentication requests
but the login page seems to be broken and a ticket is getting generated we try to create an account. We would appreciate any help on this matter.
We tried this link - "http://156.46.20.206:8000/eden/xforms/submission" from the browser and it also redirected us to the login page.
We have been trying to create an account on the Sahana Eden server so that we could use the login credentials to bypass the authentication requests
This is a standard issue for all mobile applications that require authentication. Supplying credentials in the http auth header is likely the right thing to do. (I believe Dominic has recommended this in the past.)
2. When looking into the ODK collect code for authentication we found that on form submission, the server gets redirected to the login page and returns an HTTP code of 200 which causes an exception to be thrown.
3. We are trying to come up with a compatabile logic for sending username and password in the latest version of ODK collect.
4. We tried a couple of things other than the one mentioned above to understand the redirection flow in xforms.py
i) We remove this code "@auth.s3_requires_membership(2)" ( present here " https://github.com/flavour/eden/blob/master/controllers/xforms.py#L306 " ) temporarily from xforms.py so as to understand how redirection works.
> Do you want me to share the code ?Java code?
Sorry, I'm really not the best person to help with that I'm
afraid...try the ODK community? Other Android communities?
Feel free to post here anyway just in case someone else subscribed here can make sense of it...
HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(
ClientContext.CREDS_PROVIDER);
HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
if (authState.getAuthScheme() == null) {
AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort());
Credentials creds = credsProvider.getCredentials(authScope);
if (creds != null) {
authState.setAuthScheme(new BasicScheme());
authState.setCredentials(creds);
}
}
}
};
defaultHttpclient.addRequestInterceptor(preemptiveAuth, 0);
We are trying to set the credentials from HTTP auth in the ODK Collect code by using the following -HttpRequestInterceptor preemptiveAuth = new HttpRequestInterceptor() {
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(
ClientContext.CREDS_PROVIDER);
HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
if (authState.getAuthScheme() == null) {
AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort());
Credentials creds = credsProvider.getCredentials(authScope);
if (creds != null) {
authState.setAuthScheme(new BasicScheme());
authState.setCredentials(creds);
}
}
}
};
defaultHttpclient.addRequestInterceptor(preemptiveAuth, 0);
On debugging we found that creds object is coming as null and it is not setting credentials because of that.We want to pass the authentication details in the header with preemptive auth enabled so that submission of the xforms, passes the authentication at the server side.
> ...the next step will be to step through what happens inside
> s3_logged_in() for both requests, and see where they diverge.
I would try to look at the packets using a packet sniffer to see how they differ.
localContext.setAttribute("preemptive-auth", basicAuth); --> Hope this is what is required.
basic = current.request.env.http_authorizationif not basic or not basic[:6].lower() == 'basic ':return (True, False, False)
(username, password) = base64.b64decode(basic[6:]).split(':')return (True, True, self.login_bare(username, password))
Also on the github link - https://github.com/altafhussain/Sahana-ODK-Collect-Client in the README.txt i have added the steps to setup the project in case anyone wants to try it.
With HTTPs i am getting -> javax.net.ssl.SSLPeerUnverifiedException: No peer certificate --> Any idea about this ?
Hi Fran,Hope you are doing fine.
So, Using the HTTPS connection we are getting the following error: " javax.net.ssl.SSLPeerUnverifiedException: No peer certificate". Can you please help us to resolve the error? Or any idea what could be causing this error to happen?
I tried the 3rd option that you suggested I.e. to generate a self signed certificate. ...I had used the first link you provided -
I am accessing from my Android phone through the ODK Collect Client, so I copied these files there and installed the certificate from settings.
Do we have to include this at the server side ?
I did not completely understand the last part of the email
"After that, the next step would be looking into how to ask the user if they want to trust it, and how to have the TrustManager accept it. That is not wasted effort -- it's not just something you'd need during testing -- because asking the user about an untrusted cert comes up in the real world too. For one thing, it would allow the user to accept certs issued by CACert."
Fran, we had some python doubts as well :) -
What exactly do you need here?I'm afraid that I don't see anything actionable for me here.
I installed the certificates on server side taking off the passphrase.
After i gave the arguments for including the certs ( I have copied them in web2py directory)
initially i got the error - Warning that SSL was turned off.I checked the web2py directory, that had ssl folder,
so i just ran a build and install of setup.py
and tried starting the sever again
I am now getting -Traceback (most recent call last):File "C:\Program Files\Eden\web2py\web2py.py", line 20, in <module>gluon.widget.start(cron=True)File "C:\Program Files\Eden\web2py\gluon\widget.py", line 976, in startinterfaces=options.interfaces)File "C:\Program Files\Eden\web2py\gluon\main.py", line 783, in __init__elif not rocket.ssl:AttributeError: 'module' object has no attribute 'ssl'
I checked for this to find that python should be installed with opensslBut i was not able to proceed with it.. It had a few steps regarding changing Modules/setup.dist file which was not there in my Python directory.
Is there any step while configuring web2py that we are missing which has this covered ? If not how can i get python configured with ssl support ?
The server is running on Windows machine. The folder i was referring to the one that was mentioned in those links - Modules/setup.dist
You have been starting web2py successfully prior to this -- how do you start it? From Eclipse? or on the command line with python web2py.py?
- Yes, i have been doing it from Eclipse. this time i had provided the certificates as part of program arguments.
1) Which Python version are you using?
- 2.7.2
2) Start python on the command line and try to import ssl -- is there an error?
>>> import ssl
- No error.
3) Has anyone been making direct changes in the Python installation, not via standard Python installation tools?
- No. I reported the things i tried.Debug Analysis:import ssl failed. it went on to set has_ssl as false.
In the __init__ from the gluon directory, i couldnt find the code for setting self.ssl.
In that case, in Eclipse, set a breakpoint in gluon/rocket.py right at the top of the file where it tries to import ssl, and another inside the Connection class __init__ where it sets self.ssl (just in case it gets that far).
1) When you tried the import ssl from the command line, was that on the server? If not, try it on the server.
--- I had tried on the command line outside.When tried from inside the web2py directory (from command line), it gave an error
>>> import sslTraceback (most recent call last):File "<stdin>", line 1, in <module>File "ssl\__init__.py", line 61, in <module>import _ssl2 # if we can't import it, let the error propagateImportError: No module named _ssl2
3) Is Eclipse using the same copy of python as you are using at the command line?-- We checked the version of python on eclipse, its 2.7 . Its interpretor is pointing to the same python installation.
in web2py directory also, the python version is 2.7
4) Start Web2py from the command line on the server, not from Eclipse, and see if it still can't find ssl.
-- Tried this as well. Getting the same exception that we got from eclipse 'module' object has no attribute sslSeems like web2py is not pointing to the correct python , which is running from the command line , as from command line import ssl is working fine.
>>> import sslTraceback (most recent call last):File "<stdin>", line 1, in <module>File "ssl\__init__.py", line 61, in <module>import _ssl2 # if we can't import it, let the error propagateImportError: No module named _ssl2
Oho. So it found something with the name ssl, but that ssl is broken.
Let me go find my Python's copy of ssl, and see if it has code like that.
(There's also the add-on ssl package for older versions of Python -- can check there too, but that's unlikely to be involved. Would mean there were two Python installations, both 2.7, one with the real ssl and one with its ssl overwritten with the old add-on package.)
...
Let me go see if I can track down that ssl/__init__.py that has import _ssl2.
You're logged in on the server, and start a command prompt (cmd.exe), if you are cd'd to (say) your own directory, and start Python with just the bare "python" command, it finds ssl,but then you cd to the web2py directory, do the same thing, and it doesn't find ssl?-- Yes. It gives the error.echo %PATH%
-- For python, this has the path of the normal python installation -%PATH%;C:\Python27
import sysprint sys.path-- This gave the following from both outside and inside web2py directory-
['', 'C:\\Python27\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin']
Or maybe it has Cygwin.....-- I do have a Cygwin directory in C. However the paths at both the places are showing the C:\Python version.
Should i try changing with the Cygwin directory ? (Renaming that copy of python) ??
Run -> Run Configurations -> (the config you use to start Web2py) -> Interpreter-- Had missed this one, but i tried with this as well. It was not able to import ssl
python -vTried this from both the directories to find different outcomes ..
Would mean there were two Python installations, both 2.7, one with the real ssl and one with its ssl overwritten with the old add-on package.)--This seems to be the issue i guess here, ssl seems to be overridden. Is there any way to fix that, without re installing everything again?
How was Web2py installed on the server? Was it the bundle "For Windows" gotten from here:-- No, we had installed this one -
I have setup skype (and also teamviewer in case needed) on the remote machine.My skype id - parikshitdeshpande
I discussed with my team members for a suitable time.Is 30 Nov, 2.30 PM (EST .. 7.30 PM GMT) ok for you ?
-- Pat
--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To post to this group, send email to sahan...@googlegroups.com.
To unsubscribe from this group, send email to sahana-eden...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Just to brief you up with our installation process that we followed to set up Sahana Eden server and the ODK Collect Client.