Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/tamain/public_html/_includes/cmsbclass.php on line 124 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/tamain/public_html/_includes/custclass.php on line 126
Over the weekend, we had a chance to work on our Pooh Paradise once again. This time we accomplished the following:
Ensuring WCF was correctly configured on the server
Created a series of data collection routines (GetManufacturer, GetClassifications, GetCollections, etc) as well as routines that will return back data about a single entry in the database (GetRecord(ItemId)).
The first step in any of this is making sure the WCF service is configured correctly. Because we want to be able to communicate via PHP, it's important to have the binding set to basicHttpBinding. Could there be some version of PHP communicating with some version of IIS running some version of .Net that does not need this? Possibly, but by setting our binding to basicHttpBinding we are assured that we can speak with any client that supports WS-I standards.
Next, we wrote a series of data collection routines as noted above. For grins, we decided to have these routines return a List<string> return value. Ultimately, we may have them all return XML strings, but wanted to see what would happen. Keep in mind, this is both a demonstration of what can be done as well as a training project, so a large portion of what we're doing here is experimenting with different ways of doing things.
For example in IService1.cs:
And in Service1.cs:
Next, we needed to make sure our PHP site could talk to our service, so we needed to enable php_soap.dll in the php.ini file.
Once all of that was accomplished, writing the PHP code was rather simple:
Again, please keep in mind this project is for testing and demonstration purposes, so there may be other ways to accomplish each step of this. When this is all said and done, and we've developed all our front-ends, we will probably change this code several times. This is just put out here as an example of using a handful of current technologies to accomplish something useful.
Now that we have our classifications, we can use them in a selection list, for example:
There are a lot of pieces to create a good web service, but the important thing to note here is that if you have data on your network that is not otherwise publically available, but you need that data for something - a customer service portal, a field sales force application or anything, TechAnalysts can help you achieve this goal by creating a web service that only exposes what you want exposed, but highly protects anything that you don't want available.
By the time our next post comes out, we will have created a mobile website that allows Deb to search her database to see if she has an item before purchasing it.