csweb starting from scratch

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Forum rules
New release: CSPro 8.0
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

csweb starting from scratch

Post by AriSilva »

Hi folks,
This is my first approach to the synchronization using CSWeb (I´ve tried using dropbox and it worked).
I´ve installed the wampserver64 and it is working.
Using the 1 - Data Entry\Synchronization In Logic example, and reading the readme.txt file I have several doubts:

1. Line 24, it says modify server URL, username and password .....
The line I have to modify has
if syncconnect(CSWeb, "http://www.myserver.org/api") = 1 then
what should I put there, since I do not see any username nor password?
Is the followwing correct?
if syncconnect(CSWeb, "http://localhost/csweb/api") = 1 then

2. Line 26 says "Upload the dictionary
Household/HouseholdQuestionnaire.dcf to the server"
"upload" means ""copy"? To which folder?
All the best
Best
Ari
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: csweb starting from scratch

Post by AriSilva »

Hi folks,
This is not a reply but an append to my problem:
After copying the synchronization in logic to my cel and executing the csentry, I´ve tried to synchronize it to the headquarters from the supervisor hole.
First it asked me for my username and password. I did not see any place when I setup the csweb in apache that I should allow users and passwords for this application, so I used the admin/xxxx combination I set in the setup, and the csentry gave me an error message like "csentry error 100119 error connecting to sync server java.net. Connection failed to connect to localhost/127/0/0/1 (port 80)" after 10000 ms: isconnect failed. ECONNREFUSED (Connection refused).
I´m really lost here.
All the best
Ari
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: csweb starting from scratch

Post by josh »

Hi Ari,

If you are running your server on localhost (127.0.0.1) it will only be accessible from the PC that you are running your application on. Localhost is a special address that is used for only local websites and services. This means that your cell phone or another device on your network cannot access a website running on localhost on another computer. To allow other devices to connect to your PC you need to set up your PC with a static IP address and ideally a domain name as well. This is true not just for CSWeb but for any website that you want to access from another computer. How to set this up is a bit beyond the scope of CSPro support but there is lots of info online about how to set up a publicly available website. You may want to get help from someone who has done it before. Personally, unless you are just using your site for testing, I wouldn't try to run it from your own computer. Instead I would use a cloud hosting service which does most of the hard work for you. There are many inexpensive hosting services out there. For CSWeb you just need one that supports PHP and MySQL and nearly all of them do that.

To upload the dictionary, login to the CSWeb UI in your web browser. In your setup this would be http://localhost/csweb/ui. Use the admin username/password. Click on "Data" on the left side and then on the "Add dictionary" button. This will ask you to choose the dictionary file to upload.

To create new usernames/passwords in CSWeb, login to the CSWeb UI in your web browser and click on the "users" tab on the left side. From there you can add new users. Standard users can only access the system via sync so they are what you use from phones/tablets, administrative users can also access the web interface in the browser.

You can optionally specify the username/password in the call syncconnect:

syncconnect(CSWeb, "http://myserver.org/csweb/api", "myusername", "mypassword")

If you don't specify it there then CSPro will ask you to enter it the first time and save it after that.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: csweb starting from scratch

Post by AriSilva »

Hi Josh,
I´ve added a new standard user to the csweb.
I´ve uploded the dictionary.
I´m using my url address as I saw it in ipconfig, which is 192.168.1.104
The instruction is like this
if syncconnect(CSWeb, "http://192.168.1.104/csweb/api") = 1 then
I´ve executed again the bat to create the deployment, and copied it to the user phone.
I´ve entered a couple of questionnaires, but when I tried to sync them with the username and psw it said the combination was invalid.
I´ve tried with another url address, adding :80, as in
if syncconnect(CSWeb, "http://192.168.1.104:80/csweb/api") = 1 then
Did not work as well.
What am I doing wrong this time?
Best
Ari
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: csweb starting from scratch

Post by josh »

Make sure that you have an opening in the firewall on the PC. Also you need to make sure your web server is configured to allow connections from any host rather than just localhost. Finally, make sure that you phone and PC are on the same local area network. If your phone is connected using 3G this probably won't work since 192.168.1.104 is a local ip address not a public address exposed outside your router.

Rather than test with CSPro, I would use the web browser on your phone and make sure that you can reach CSWeb ui from there i.e. enter http://192.168.1.104/csweb/ui (ui not api for the web interface) in the browser on your phone. If that works then you have the correct ip and your website is configured correctly. If that works then you probably just have the wrong username or password.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: csweb starting from scratch

Post by AriSilva »

Hi Josh,
I´ve tried what you said, to use the browser with that IP, and got the following message:
Forbidden
You don´t have permission to access /csweb/ui on this server
Best
Ari
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: csweb starting from scratch

Post by josh »

There is probably something you need to change in your web server configuration to make the website available from outside the local computer. You will need to look at the documentation for the web server you are using to see how to change the configuration to allow this. Like I said, we expect that if you are going to use CSWeb that you know how to set up a web server so we don't help with that part.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: csweb starting from scratch

Post by AriSilva »

Hi Josh,
I´m using wampserver64, and I did not see anything in the documentation that could help. The only note remotely related was to uncomment an instruction in the Apache htppd.conf, which I did.
One of the differences is that I installed int in D:\ instead of C:\, but I do not think that is the cause of not connecting.
Best
Ari
Best
Ari
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: csweb starting from scratch

Post by AriSilva »

Hi Josh,
Finally a friend of mine helped me with the apache configuration.
The problem, just for you to know and probably to help other users, was in the httpd-vhosts.conf installed by the wampserver, where it says
Require local (comment this line, 10)
and write
Require all granted.

Now the synchronization seemed to be working, but I have two additional problems:
1. When doing the synchronization from the celular, apparently it executes it, but nothing appears at the Data folder in the
files/synchronization with logic/data.
2. When trying to execute the download with the Dataviewer, I put http://localhost/csweb, and it asks for a username and psw. I tried several, including the admin and my psw, and it says invalid combination.
Best
Ari
Attachments
Apache.PNG
Apache.PNG (32.18 KiB) Viewed 28376 times
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: csweb starting from scratch

Post by josh »

Glad to hear you got the Apache issues worked out.

If you are synchronizing CSPro data files then you won't see any files created on the server. The data uploaded from the tablets are stored in the MySQL database.

To debug problems with sync, always start by looking at the sync.log file. On Windows this will be in C:\Users\<your username>\AppData\Roaming\CSPro. On Android this file will be in the csentry directory. If there are errors occurring when you try to login the details will be in this file.
Post Reply