Facebook Integration

As you have probably noticed, I have integrated a pseudo-Facebook hook into my little WordPress blog. I am wanting more comments to come thru via Facebook, and am building a full Facebook application that will integrate my posts in a non WordPress format, link to different resources on command and provide a way to search and query those items. All on Facebook. The way I am doing this right now is using the Facebook Application with the iframe setting.

So if you have not had a chance to connect to my Facebook App, here is a shameless plug to go ahead and do this now. I will combining the HirdWeb page with the HirdWeb Application. Since I am on Facebook quite a bit, and doing applications for Facebook API integration, I will start to share some of those techniques.

The application I will be walking through is an application I already have half way set up at my own site: www.stephenhird.com. This will soon be taken down and I will be putting up a better site to show the power of the Facebook API and how to integrate your site with Facebook for different things. As always, I will post the entire code page and any connections it needs to have. I will also post the directory structure of a possible integration of the Facebook API into an external application.

Testing the NuSOAP Webservice in C#

For the past few posts, the main focus has been a NuSOAP Webservice that does really basic things with very limited data. The different functions of the service have done a variety of things:

  • showNumbers – Returns an array of numbers in a non-assoc array key format
  • showMadLib – Returns a mad lib based on the data it is sent. Need 4 Adjectives, 2 Adverbs, 3 Nouns, 1 Verb, and 2 Verb: Past Tense. It replies with a string that contains the madlib.
  • showGroupItems – Simplistic service to return an array of items for a specific event, the ones available are: movie, picnic, drive, shopping
  • showTaxes – Shows the taxes based on state taxes. Currently, the only states available in this are: AZ,AL,AK, CA, OR, WA, UT, ID, WY, Defaults to CA if no state is provided. The input for this function is an array.
  • showPhrases – Shows a phrase from Shakespeare and replaces the name with the supplied name. ID is a number from 0 – 4

Although these are very basic and the real world applications are very limited, it can provide a spring board to building real world webservices that can be used for a variety of reasons. But, the power of webservices are that they can be code independent if written correctly. The server portion we have done is all in PHP. The client we have tested this on has been a PHP base. Based on the client functioning properly, we know that PHP based applications will be able to access the data. But the web is not 100% PHP based. Other code exists, which could be .NET flavors, Java, even ColdFusion. We need to ensure that the webservice built will be accepted by applications written in other languages.
Continue reading Testing the NuSOAP Webservice in C#

Modifying the NuSOAP Server

OK, the last couple of posts have strayed from the NuSOAP topic. but I wanted to do a quick post before going into to testing the server on a .NET application. The whole point of this post is to modify the result set we are sending back for some of the items. And let’s also change around one of the inputs so it accepts an array of data as the input, instead of strings. Hopefully this example will help others build a NuSOAP server. Which is why I am doing some of these examples. I was tired of seeing example after example of NuSOAP servers with a “Hello World” type of structure. That does not help in the real world. So hopefully these examples will help others.

First, we need to recall our last example we had out there, it was the following files:
Data Used: http://www.hirdweb.com/webservice/items.txt
Server File: http://www.hirdweb.com/webservice/20100720_server.txt
Client File: http://www.hirdweb.com/webservice/20100720.txt

We will be modifying those files, so if you do not already have those, you can grab those there. The data file “items” is ok, and we do not need to change anything there. The server file we will need to change, so go ahead and save that file with a new name. After you do that, you will need to change the line in the server that sets the wsdl address. I named the new file 20100805_server.php.

$wsdl_addr = 'http://www.hirdweb.com/webservice/20100805_server.php';

The first thing to do is change the result set for the showNumbers functions. This is the function that accepts an identifier of 0 thru 5 and returns a list of numbers. It is a pretty simple example. In the real world, the identifier may be a book ISDN, or a product code, or a user id. Based on how you use this, it could return anything, like a list of authors (ISDN), or related products (product code), or friends (user ID). Or this can be used in conjunction with another function. But we need to format this a little better.
Continue reading Modifying the NuSOAP Server