How to create web service?


#1

Hi All

In my requirement is user keying user name and pwd and i pass these two values into web service.
the web service check with Database if it is valid user, then it return valid entries / menus,
we have to display information based on the user tap/ click entry.

Can anyone give a solution or suggestion?

Thanks


#2

You need a web server that provides the services you want. I can’t go into the exact details here, but I will provide some hints.

You can easily run a web server on your Mac. Just go and turn on the Web Sharing in the System Preferences. If yo do this, you will have a fully functional web server (Apache) running on your Mac.

Here is the hard but most interesting part. You need to configure the Apache server so that it accepts requests and dispatches them to other programs that the generate content (response) for the requests. Then you need to write code that sends requests to the server.

You can actually send requests to the server without writing a single line of code; for this, use the nc program from the command line interface.

From man nc:


#3

Hi ibex10, on the topic of configuring an Apache server for development purposes … is there a link to a good article or tutorial on this? I’ve done this on a windows machine with wamp but it’s been a while.

p.s., thanks for all the time you’ve spent on this forum supplying help and advice.


#4

I have done this more than a year ago, so I can’t remember the exact details.

However, try making the following changes to your /private/etc/apache2/httpd.conf and then restart the Apache server. (MAKE A COPY OF THE ORIGINAL FILE BEFORE YOU MODIFY)

httpd.conf:


#DocumentRoot "/Library/WebServer/Documents"
DocumentRoot "/Users/[color=#FF0000][/color]/Sites

This should be changed to whatever you set DocumentRoot to.

#<Directory “/Library/WebServer/Documents”>
<Directory “/Users/[color=#FF0000][/color]/Sites”>


#

#
#ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
ScriptAlias /cgi-bin “/Users/[color=#FF0000][/color]/Sites/public/cgi-bin”

“/Library/WebServer/CGI-Executables” should be changed to whatever your ScriptAliased

CGI directory exists, if you have that configured.

#<Directory “/Library/WebServer/CGI-Executables”>
<Directory “/Users/[color=#FF0000][/color]/Sites/public/cgi-bin”>
AllowOverride None
Options None
Order allow,deny
Allow from all

Make sure that you replace [color=#FF0000][/color] with your user name on your machine; and put all your cgi executables in your cgi-bin directory.

But you should really read the Apache Server documentation.

Good luck!


#5

Success! I was also able to set up a virtual host for a folder I created within the Sites folder (some of the stuff I did in previous years came back … a little). So I’m on my way, and I will definitely review the Apache docs.

Thanks, ibex10!