Arsenalist

The Toronto Raptors Blog with an Arsenal touch

Archive for January, 2007

Carling Cup: Arsenal vs. Tottenham 2nd Leg Highlights

Posted by Arsenalist on January 31, 2007

Is it wrong for me to feel really good that Ashley Cole is injured? Poor Scum, it’s hard to believe they had a 2-0 lead at home in the semis and blew it to the Gunner second team. Mido’s late header brought the Spurs some hope but it was all over when Aliadiere smashed one in during extra time.

The Henry/Adebayor dance is annoying to the point of being ridiculous. I bet that’s more Adebayor’s stupid idea rather than Henry’s.

Here are the goals and match highlights:

Adebayor 1-0

Mido 1-1

Aliadiere [2-1]

Chimbonda (Own Goal) 3-1

Match Highlights

Posted in arsenal, carling cup, tottenham, video | 3 Comments »

FA Cup: Arsenal vs. Bolton Highlights

Posted by Arsenalist on January 28, 2007

Note: If you’re looking for the Arsenal vs. Bolton Highlights from the replay at the Reebok stadium, go here.

Since YouTube has suspended my account, the goals and highlights will now be posted on DailyMotion until they suspend my account.

For a while there I thought Bolton was going to end our run in the FA Cup. The replay is on Valentine’s Day at the Reebok Stadium. Walcott should’ve done much, much better on his volley in the second half, he needs to score his first Gunner goal in the worst possible way just so he can prove to himself that he can score. There was a Jeremie Aliadiere sighting as he along with Baptista were brought in late by Arsene Wenger in hopes of putting the Gunners through. Aliadiere tried to be a hero in injury time but released a shot that only his mother could be proud of. Arsenal tried to win the game late by throwing long balls to Thierry Henry but the Bolton defense did a good job of denying Henry space. The Gunners dominated the last fifteen minutes of play by applying constant pressure on Bolton, but the Wanderers were pretty set on earning the replay.

Henry and Adebayor did not have good games. Both were waiting for the perfect ball to come to them instead of helping to create attacks. It’s evident why Robin van Persie is preferred to Adebayor; this season the Dutchman always seems to be at the right place at the right time and his presence will be sorely missed. Julio Baptisa was brought into the game when Wenger’s hand was pushed but he needs a lot of the work to be done for him before he finds the back of the net. The replay is winnable but Henry, Adebayor must be far more influential than today.

Kevin Nolan 1-0

Kolo Toure 1-1

Posted in arsenal, bolton, fa cup, video | 3 Comments »

.500 Raptors claw past Boston

Posted by Arsenalist on January 27, 2007

It’s been a long time, four years to be precise, since the Raptors were at level terms in the NBA regulation season this late in the season. So what does .500 record buy you? 7th in the Eastern conference and a momentary Atlantic division lead. Things have come a long way since the final days of Vince Carter and along with giving Bryan Colangelo credit, keep in mind that it was also Rob Babcock that brought in a couple of the key players playing today - Jose Calderon and TJ Ford (via much maligned Charlie Villanueva). The future hasn’t been this bright since Carter reverse-dunked on Chris Mullin in Indiana ages ago.

The Boston Celtics played the same way they did two weeks ago in Boston and let the Celtics hang around for much longer than they should have but it didn’t come back to haunt them. Bosh had another solid game with 26/8 and Anthony Parker hit 7 threes in his 23 points. Delonte West, Al Jefferson and Allan Ray are players you can build around; everytime Jefferson pumped faked Bosh to easily go by him and dunk it, I wished he played for the Raptors. This game only confirmed the widespread theory that the Raptors’ defense is porous for a long stretches of the game. It hasn’t come back to bite them lately because the quality of the opposition has been fairly sub-par. Last time they played a decent team (Utah), they got carved to death.

It starting to dawn on me that Gerald Green might just suck. Green’s an athlete who can’t seem to shoot, dribble or pass. His 5-16 FG (2-10 for 3’s) hurt Boston as most of his shots came outside of Doc Rivers’ “offense”. Boston committed 18 turnovers, many of them unforced, and if it weren’t for them the Celtics might have had a decent chance to pull out a win. Give the Raptors - especially Bosh and Parker - credit, they managed to hit big shots anytime the Celtics either got too close or as in the fourth quarter, started to pull away. The Raptors have shown that they can deploy a zone defense to some success, now if they could only play good perimeter man-to-man, they’d be in great shape.

It’s at Indiana on Saturday before the Wizards get a a chance at revenge on Wednesday and that will be a true test for the Raps as Washington nearly pulled of a massive comeback last time these two clubs played.

Posted in Raptors, celtics, nba | No Comments »

Python client for web services using WS-Security

Posted by Arsenalist on January 27, 2007

Hopefully this entry serves as some decent documentation on how to write a Python client that accesses a web service which uses WS-Security. When I was trying to figure it out, Otu Ekanem’s response on the mailing list was invaluable. The example is relevant for any web service framework independent of programming language. This is tested with XFire 1.2.4 but can be used with .NET or other Java web service frameworks like Axis2.

When accessing a web service which has WS-Security enabled you must send very specific headers as part of your SOAP envelope in order for the request to be processed. You can read all about the glorious specification in PDF Format if you like. I’m using the Zolera Soap Infrastructure (ZSI) Library for Python which supports client stub generation. Given the generated stubs, there are two ways of adding custom headers to outgoing SOAP messages.

Method 1 - Not desirable but worth a mention

The first method involves modifying the generated code which is highly undesirable. Using the very simple SportsService web service example, you must modify the generated SportsService_client.py and edit the following line:


self.binding.Send(None, None,
   request, soapaction="", **kw)

to read


self.binding.Send(None, None,
   request, soapaction="", soapheaders=(obj1,obj2) )

where obj1 and obj2 are instances of Python objects which are serialized as part of the SOAP header. I found this way to be tedious as you have to design your classes to match the SOAP header and write additional serialization code. It is also hard to create the exact header as namespaces and prefixes tend to be a problem.

Method 2 - Probably the way to go, way more customizable

We can use DOM-like methods to modify the SOAP header and send out exactly what we need. The example implements the UsernameToken strategy but other ones can also be implemented by modifying the headers in a similar manner. The generated Port class’ binding attribute has a sig_handler attribute which can be assigned an instance of a custom class. In this custom class, we must implement two methods, sign and verify, that can modify the header and check it’s validity, respectively. The sign method takes in as argument a SoapWriter which enables us to modify the header. So without further ado, here’s the class that adds WS-Security headers to the outgoing SOAP envelope as discussed above. The code has been formatted and modified to fit the page.


# Deprecated in 2.5, use the hashlib module instead:
#     http://docs.python.org/lib/module-hashlib.html
import sha 

import binascii
import base64
import time
import random

class SignatureHandler:

  OASIS_PREFIX =
    "http://docs.oasis-open.org/wss/2004/01/" +
      "oasis-200401"

  SEC_NS = OASIS_PREFIX +
    "-wss-wssecurity-secext-1.0.xsd"
  UTIL_NS = OASIS_PREFIX +
    "-wss-wssecurity-utility-1.0.xsd"
  PASSWORD_DIGEST_TYPE = OASIS_PREFIX +
    "-wss-username-token-profile-1.0#PasswordDigest"
  PASSWORD_PLAIN_TYPE = OASIS_PREFIX +
    "-wss-username-token-profile-1.0#PasswordText"

  def __init__(self, user, password, useDigest=False):
    self._user = user
    self._created = time.strftime('%Y-%m-%dT%H:%M:%SZ',
      time.gmtime(time.time()))
    self._nonce = sha.new(str(random.random())).
      digest()
    if (useDigest):
      self._passwordType = self.PASSWORD_DIGEST_TYPE
      digest = sha.new(self._nonce + self._created +
        password).digest()

      # binascii.b2a_base64 adds a newline at the end
      self._password = binascii.b2a_base64(digest)[:-1]
    else:
      self._passwordType = self.PASSWORD_PLAIN_TYPE
      self._password = password        

  def sign(self,soapWriter):    

    # create  element
    securityElem = soapWriter._header.
      createAppendElement("", "wsse:Security")
    securityElem.node.
      setAttribute("xmlns:wsse", self.SEC_NS)
    securityElem.node.
      setAttribute("SOAP-ENV:mustunderstand", "1")

    # create  element
    usernameTokenElem = securityElem.
      createAppendElement("", "wsse:UsernameToken")
    usernameTokenElem.node.
      setAttribute("xmlns:wsse", self.SEC_NS)
    usernameTokenElem.node.
      setAttribute("xmlns:wsu", self.UTIL_NS)

    # create  element
    usernameElem = usernameTokenElem.
      createAppendElement("", "wsse:Username")
    usernameElem.node.
      setAttribute("xmlns:wsse", self.SEC_NS)

    # create  element
    passwordElem = usernameTokenElem.
      createAppendElement("", "wsse:Password")
    passwordElem.node.
      setAttribute("xmlns:wsse", self.SEC_NS)
    passwordElem.node.
      setAttribute("Type", self._passwordType)

    # create  element
    nonceElem = usernameTokenElem.
      createAppendElement("", "wsse:Nonce")
    nonceElem.node.
      setAttribute("xmlns:wsse", self.SEC_NS)

    # create  element
    createdElem = usernameTokenElem.
      createAppendElement("", "wsse:Created")
    createdElem.node.
      setAttribute("xmlns:wsse", self.UTIL_NS)

    # put values in elements
    usernameElem.
      createAppendTextNode(self._user)
    passwordElem.
      createAppendTextNode(self._password)
    # binascii.b2a_base64 adds a newline at the end
    nonceElem.
      createAppendTextNode(
        binascii.b2a_base64(self._nonce)[:-1])
    createdElem.createAppendTextNode(self._created)

  def verify(self,soapWriter):
    self

Example usage of this is:


from SportsService_client import *
from SportsService_types import *

locator = SportsServiceLocator()
port = locator.getSportsServiceHttpPort()
sigHandler = SignatureHandler("user", "password", True)
port.binding.sig_handler = sigHandler

request = getMascotRequest()
teamObj = ns0.Team_Def("Team")
teamObj._name = "toronto"
request._team = teamObj

response = port.getMascot(request)
print response._out._name

As you can see the SignatureHandler class is implementing an “interface” which enables it to process outgoing SOAP Requests. The verify method is empty but can contain code to check whether the SOAP header is valid.

If you would like write a PHP client that accesses a WS-Security enabled service, you should read Kim Cameron’s IdentityBlog entry which has links to the source code needed. If you simply want to use a PHP client for a non WS-Security web service, an earlier blog entry covers that.

Posted in python, tech, web services | 8 Comments »

Raptors come back from 15 down to beat Hornets

Posted by Arsenalist on January 25, 2007

The warning signs were all over the wall. I was weary after the Bobcats game and with good reason because the Raptors have major difficulty stopping teams that decide to drive on every single possession. So when the Hornets came in to town on a back-to-back and losers of 10 of 11 on the road, I thought the chance of an upset was there. And I would’ve been right if it weren’t for Chris Bosh doing a MJ impersonation and Jose Calderon making a legitimate calling for a starting PG job in the fourth quarter. I would’ve been right if Mo Pete hadn’t pulled up on a semi-break for what could be considered a really bad shot but made up for it by draining a three to cut the lead to three. I would’ve been right if Bosh hadn’t attempted an out-of-the-offense three which rattled in and out to tie the game….

After being unable to stop Bobby Jackson or Rasual Butler for the majority of the game, the Raptors defense came up big midway through the fourth. After being down 15 in the fourth, inspiration found its way through and a tired Charlotte defense offered little resistance to Calderon’s drives or to anything the Raptors threw at them. The comeback would’ve been completed far sooner if Garbajosa, Parker and Mo Pete would’ve been able to hit wide open shots in the fourth and it wasn’t until :28 seconds left that the Raptors got their first lead 85-83 on a Calderon driving layup. Until then it was mostly swinging between a 6 and a 10 point lead for the majority of the game and playing catch-up against any NBA team is an unenviable task, which even if one has to undertake, must be done so at home. The boisterous crowd of 14,173 was loud and the undisputed 6th man of the night.

Enough beating around The Bosh. Let’s get to the point: This was his night and without him we would’ve suffered a horrible, face-defacing lost that would’ve signalled a near white flag in the Titanic Division race. 35 points, 7 rebound, 4 assists, 2 blocks and only 1 turnover for the Raptors franchise man was the reason the Raptors won. Bosh hit two clutch jumpers, one to cut the lead to 3 and another to tie the game. Nobody could stop him the entire night and it was a tactical mistake for anybody even to attempt a jumper when nobody on Charlotte showed any evidence of slowing down Bosh. If we would’ve lost the game, the blame might have fallen on the coaching staff not taking advantage of a clear advantage.

The Raptors were without TJ Ford for a second successive game and didn’t seem to skip a beat with Calderon playing 42+ minutes to make up for his abscense. Andrea Bargnani and his three’s also were unavailable tonight. The Hornets knew that this was a winnable game and played like they meant to win this one and one can make a case, they deserved to do so. They played solid basketball going inside first and only taking jumpers that were created by drives or ball movement. Nothing was forced and their perimeter defense was tight as the close-outs on Mo Pete and Anthony Parker didn’t allow anything easy. David West had a manly 11 rebounds to go with 9 points and played the fourth quarter on one leg.

What goes around, comes around. The Raptors got lucky and good in the fourth quarter just like they got unlucky and bad in the fourth against Dallas; they can probably get away with a similar performance in their next game against Boston but if a division title is to be contended for, nights like these need not be frequented so often.

Chuck’s getting pretty conservative on the salami and cheese call; tonight he brought it out with the Raps up 4 with 2.6 seconds left.  He could’ve just as easily brought it out with 20 seconds left with the same point differential.  Swirsky’s does not want any Laker game repeats.

Posted in Raptors, hornets, nba | No Comments »

Sorry Spurs can’t hang on to gift wrapped lead

Posted by Arsenalist on January 25, 2007

First off my YouTube account was suspended because of copyright violations so I can’t put highlights up there anymore. I tried looking at sites like FlUrl and Metacafe but those appear heavily geared towards porn than sports. So for now, no highlights for this game until somebody else puts them up somewhere. They’ll be back for the Bolton game. For now here’s a clip from YouTube courtesty of la-roda.

There’s also another highlight package posted on DailyMotion.

Only caught bits and pieces of the game and once the Gunners were down 0-2, fear failed to settle in. If we can come back against Man Utd, the pathetic little scum are little opposition, even when the big guns aren’t playing. Baptista scores three goals in the game including two for us and we ended up earning a rematch at the Emirates. Arsenal rested nearly everyone and fielded the following squad for the game:

2. Abou Diaby
4. Francesc Fabregas
5. Kolo Toure
6. Philippe Senderos
9. Julio Baptista
13. Alexander Hleb
15. Denilson
16. Mathieu Flamini
21. Mart Poom
24. Manuel Almunia
27. Emmanuel Eboue
30. Jeremie Aliadiere
31. Justin Hoyte
32. Theo Walcott
43. Mark Randall
45. Armand Traore

As you can make out the plethora of talent wasn’t there. The decisive play of the game was Justin Hoyte’s run down the right to setup Baptista for his second easy one of the night. That made it 2-2 with still about 13 minutes to play. At that time I would’ve thought that there was no way this game was going to end tied as both teams had no trouble stringing passes together to at least create runs down the sides. Robbie Keane came close to scoring on a run down the middle but Almunia got his hand on it late in the game. Arsenal strung together a few counter-attacks after Baptista’s equalizer but the final touch never came. Although the on-loan Brazilian has failed to produce consistently in the league, he seems to be finding things rather easy in the Carling Cup. He’s scored six goals in his last two games which must make Arsene Wenger at least ponder a little whether to keep him on at the end of the season.

Next week’s tie at the Emirates will put the Gunners in the Carling Cup finals.

Posted in arsenal, carling cup, tottenham, video, youtube | 6 Comments »

Raps beat ‘Cats despite bad first half

Posted by Arsenalist on January 23, 2007

pape sow raptors bobcats
Pape Sow celebrates his first
points of the season
If anybody gives up 53 points in a half to the Bobcats at home, things aren’t going great even if the final score is a blowout and the fans go home with pizza. The first half saw many bad things happen to the Raptors including Bosh picking up two early fouls and soon a third sending him to the bench and forcing Sam Mitchell to dust off Fred Jones’ uniform. The 3-happy Andrea Bargnani was getting constantly schooled by Gerald Wallace in the post and was eventually sanctioned to the bench in favor of Joey Graham. Graham also gave Wallace too much credit for a jumper he bluffed he had and played into the physical forward’s game by not giving him space to shoot.

The Raptors did have an early 10 point lead but it was one of those leads that will never last (somewhat like the Dallas lead) and I was just waiting for the game to be tied. Sure enough, Bobcats tied it and even went ahead; things weren’t looking promising and it looked like the team was still lingering from the Utah game.

Great part about Chuck Swirsky is that when things are going mildly well, he’ll make you think your team’s up by 20. Example: Bargnani hits a three and Chuck starts yelling it’s raining threes and all that Il Mago stuff. You know what Chuck, it’s a four point game. Calm down and let’s focus on the Raptors defense which was nowhere to be found in the first half. They kept showing the stats between Adam Morisson and Andrea Bargnani and kept saying how Bargnani was outplaying Morrison in the matchup. CHUCK, THEY WEREN’T GUARDING EACH OTHER. Eventually Leo Rautins pointed that minor detail out to restore some sanity.

After Bosh (20, 5) had a good rest in the first half, he came back with a purpose in the second and scored 8 points in the 17-2 run to start the third which put the game out of reach from the Bobcats for good. The Bobcats scored 8 points in the quarter to the Raptors 21 which left the fourth quarter a mere formality. Charlotte lacked the depth to stay with the Raps who can score on any opposition when said opposition is of the quality of the Bobcats or any other team that lacks defensive fundamentals and attempts to use athleticism as a form of defense.  Once the Raptors switched to a zone defense in the second half, the Bobcats were forced to take jumpers they couldn’t make.  That was their ultimate demise.

No TJ Ford in this game due to an ankle injury which was a cause for celebration after his recent couple performances which made me nostalgic about Mike James. Despite how good Jose Calderon (19pts, 11asts) is playing, we should all keep in mind that he’s a backup point guard and the position suits him well. If he’s elevated into a starting PG’s role, unfair expectations will be made and his productivity will suffer under both the demand and pressure of a starting PG job. So anytime he has a good game, the “Start Calderon” chants don’t make much sense.

Another interesting note is how the Raptors website decided to promote the game using tempting verbiage such as “come see the moustache…” referring to Adam Morisson’s facial hair. The announced attendance of 13,997 were treated to Morisson scoring 3 points of 1-6 FG, but on the brighter side they did see the Raptors get an expected win. We as Raptor fans should show some maturity and not celebrate these expected wins at all. This game also saw the highly anticipated return of Pape Sow who contributed a three point play in his three minutes making Fred Jones look even worse. It must be noted that Sow’s hoop took the Raptors from 99 to 101 to the delight of starving fans craving for free pizza.
New Jersey and New York lost tonight which means the Raptors are tied with the Nets in the win column but still trail by a game. They hold a 2.5 game lead over the Knicks who are showing a pulse of late. All signs point to a furious finish in the Atlantic.

Next up it’s the Hornets on Wednesday. Another winnable game.

Some good fellow posted highlights from NBA TV on YouTube:

Posted in Raptors, bobcats, nba, video | No Comments »

Arsenal vs. Manchester United Highlights

Posted by Arsenalist on January 21, 2007

What I hoped earlier is what happened. Late header by The Great Man kills of Man Utd giving the Gunners a double over the Red Devils. Slow start to the game for Arsenal saw them get no early possession but the pace gradually escalated to the point where Arsenal were dominating the game at times. Senderos looked very nervous early on making some very two-minded decisions but no harm was done. Clichy held his own against Ronaldo who wasn’t damaging the Gunner defense as United would have hoped. Once he was out of the equation, the only attacking presence for United were Ryan Giggs and Wayne Rooney who was playing on the right wing in a late switch by Ferguson. Maybe it was this that confused Arsenal early on as Man Utd featured a lone striker in the form of Henrik Larson.

thierry henry header manchester united
Henry’s header beats Van der Sar in injury time

Arsenal’s best chance was a Henry header which went straight to Van Der Sar prompting the commentator to say that of all of Henry’s goals, less than double digits have come from the head. Man Utd came close to scoring in stoppage time but Jens Lehmann was up to the task of stopping Rooney on which would’ve been a sure goal. Man Utd finally broke through after Evra’s run on the right followed by a cross caught a diving Rooney’s head to make it 1-0. Arsenal were again behind at the Emirates, but this time the opposition was far more formidable. Arsenal played like Arsenal and tried to score the perfect goal too often. Their build-up and passes always deserved a better finish or a finish at all. Often they got into narrow situations which didn’t suit them well - 4 yard passes aren’t Arsenal’s game. Even after going behind, Arsenal mounted challenges that could’ve seen them score, Rosicky and Adebayor coming close. The latter was involved in a scramble in front of the United goal which saw Van der Sar shaken up.

After Robin van Persie came in for Alexander Hleb, a greater shift in momentum occurred as Arsenal attacked to a higher degree. After Rosicky and Fabregas were involved in a battle with Scholes to win the ball, Rosicky’s cross scooted past Henry’s feet and near van Persie who roofed it to tie it up. Manchester United were caught protecting the lead and now that the game was tied, they were about to get caught protecting the tie. In the 94th minute, a give-and-go between Eboue and Rosicky saw Eboue supply the ball in for Henry who after being criticized for missing his header in the first half, made no mistake.

Arsenal deserved to win the game and outplayed United for vast stretches of the game in both the first and second half. Eboue and Rooney were going at each other throughout the game and Eboue also got involved with Christiano Ronaldo who was getting frustrated by tight marking of the Ivorian combined with that of the speedy Clichy. The Arsenal back four stood tall despite early jitters and eventually preserved a well-earned victory.

Here are some YouTube highlights:

Wayne Rooney 0-1 (Chinese commentary)

Robin van Persie 1-1

Thierry Henry 2-1

Match Highlights

Posted in arsenal, man utd, premiership, video | 8 Comments »

Jazz beat Raptors as offense struggles

Posted by Arsenalist on January 20, 2007

I was at this game and it’s the best place to check out the offensive sets and assign the blame correctly when things go wrong. So what I say carries merit. It’s also hard to criticize Chris Bosh because he puts up the numbers like tonight, but if I had to pick some people who might’ve cost us the game, on the list would be Chris Bosh (29 pts and 11 rebs). Seriously, hear me out. There’s more to the 102-94 final that might not meet the eye at first glance.

carlos boozer chris boshIn reality, here’s what cost us the game: Late in the game with the Raptors down by two and on a semi-break, Mo Pete had the chance to cut the lead to two and put the pressure entirely on Utah. He received the ball on the left baseline and went for the in-your-face dunk and ended up blowing the lay-in. Utah scored on the ensuing possession to make this a four point swing and the game was essentially out of reach.

More generally speaking, Chris Bosh’s finishing around the rim has been a concern. Tonight things went relatively well so even the contorted lay-ins were falling at times. But why he bails out defenses by taking 15-ft turnaround jumpers bemuses me. Throughout the second half I thought Bosh wasn’t assertive enough on offense and allowed Okur and Boozer off the hook defensively. Mehmet Okur (27 pts and 3 rebs) was more valuable to his team than Chris Bosh because everything for him came out of the structured Utah offense, unlike Bosh who takes away from the team in getting his offensive production. Even though statistically he had a very good game, offensively he hurts the Raptors at times because he makes the offense completely stagnant and that’s exactly what happened at the start of the third when the Raptors were simply unable to score. It’s the black-hole effect. He’s not a great passer of the ball so once the ball goes in the post to him, or even when he’s facing the rim, you pretty much know a shot will be taken. I think Bosh and Kevin Garnett are in the same league: both are great second options on a great team. It might sound harsh but the lack of fluidity in Bosh’s game will always keep him from being a great player. Despite his improvement in recent years, I still think his ceiling is somewhere near the same as Jermaine O’Neal.

Let’s give the Bosh-bashing a rest. Yes, he could’ve done more tonight but he did do enough for his teammates to supply the missing pieces to get a win tonight. TJ Ford appears to have contracted the Mike James syndrome and is taking ill-advised shots on offense and really hurting the team. He single-handedly helped build Utah’s lead in the second quarter. Good to see Mitchell recognize this and put Jose Calderon who’s a great BACKUP point guard; in the fourth quarter Calderon was asked to hit some long range jumpers which he failed miserably at but you can’t really blame him - that’s not his game. He had a great game, 16 points and 5 assists. Jorge Garbajosa continues to struggle going scoreless and contributing next to nothing in 23 minutes. Maybe he’s hit the rookie wall or maybe he’s just too damn tired. Note to Jorge: Pump fakes are nice but only when they’re necessary.

Let’s get to Bargnani. I am sick of this guy trying to hit threes and not using his massive 7-ft frame. The one time tonight he actually posted up, he got two FT’s out of it. I’m not sure whether to blame him or Mitchell for his incorrect usage. On the same note, the ACC announcer is getting really annoying trying to mix in the Spanish and Italian when pronounching Jose Calderon, Jorge Garbajosa and Andrea Bargnani’s names. Give it a break brother, it’s annoying.

Give Utah credit, they were operating on peak offensive efficiency and there was nothing Sam Mitchell and the Raptors could do to stop them. I thought when Carlos Boozer picked up his fifth foul, the Raptors could have made a better effort at making him pick up his sixth. His points killed the Raptors as they always came just when we were about to get over the hump. Utah’s one of my favorite teams in the NBA and it’s great to see Jerry Sloan still produce quality basketball after all these years.

YouTube highlights courtesy of Chasin from RealGM:

Game in a Flash

Chris Bosh

Jose Calderon

Morris Peterson

Andrea Bargnani

You can check out more highlights including post-game interviews in the RealGM thread.

Posted in Raptors, jazz, nba, video | No Comments »

Writing PHP clients for XFire, Axis and .NET Web Services

Posted by Arsenalist on January 19, 2007

If you’re finding yourself hunting down incomplete documentation about writing a PHP client for your Java or .NET web services, you’re not alone. PHP SOAP toolkits like NuSOAP and Pear SOAP provide sub-par API’s into web service development and give a decent person a really hard time when it comes to writing clients. The best way to go IMHO is using PHP’s built-in SOAP libraries. The other thing to keep your eye on is Axis2 for PHP which is still in Beta. For now we’ll focus on the PHP 5 and it’s SOAP extension. To enable the extension, your php.ini file must something like the following:

Under Dynamic Extensions:

extension_dir="C:/php/ext/"
extension=php_soap.dll

Under Module Settings:

[soap]
soap.wsdl_cache_enabled=0
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400

Restart the Apache Web Server for the changes to take effect, once that is done, we are free to use the PHP Soap extensions. This example is applicable to Java web services generated by XFire or Axis or any other framework and also to .NET web services. As long as there’s a WSDL, we’re good. This example has been tested with XFire 1.2.4.

In this example there is one web service called SportsService which exposes one method: public Mascot getMascot(Team team)

The method takes in as parameter a complex Java object called Team and returns a Mascot, another complex data type. Although this example can easily use primitives, I’ve chosen to use Java objects because I want to illustrate a specific point. The XFire Java client is fairly easy to write and a previous blog entry covered a similar client. Both the Team and Mascot classes are POJO’s with one String property called name, a default constructor and getter/setter methods. They are excluded here for brevity.

Before we look at the PHP client, let’s look at the relevant portion of the WSDL that is generated, mainly the types and the information about the method getMascot which we will be calling:

<wsdl:types>
    <xsd:schema
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            attributeFormDefault="qualified"
            elementFormDefault="qualified"
            targetNamespace="http://vo.arsenalist.com">
        <xsd:complexType name="Team">
            <xsd:sequence>
                <xsd:element minOccurs="0"
                             name="name"
                             nillable="true"
                             type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:complexType name="Mascot">
            <xsd:sequence>
                <xsd:element minOccurs="0"
                             name="name"
                             nillable="true"
                             type="xsd:string"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:schema>
    <xsd:schema
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            attributeFormDefault="qualified"
            elementFormDefault="qualified"
            targetNamespace="http://ws.arsenalist.com">
        <xsd:element name="getMascot">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element maxOccurs="1"
                                 minOccurs="1"
                                 name="team"
                                 nillable="true"
                                 type="ns1:Team"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
        <xsd:element name="getMascotResponse">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element maxOccurs="1"
                                 minOccurs="1"
                                 name="out"
                                 nillable="true"
                                 type="ns1:Mascot"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>
</wsdl:types>

Here’s the PHP client that creates a Team type, passes it to the web service which returns a Mascot type.

<?php

//set up the service client using WSDL
$wsdl = "http://arsenalist.com/SportsService?wsdl";
$client = new SoapClient($wsdl);

// assign the name attribute of Team to "toronto"
$wrapper->team->name =
		new SoapVar("toronto", XSD_STRING);

// call the getMascot method
$response = $client->__soapCall("getMascot",
				    array($wrapper));

// print out the Mascot
print($response->out->name);

?>

The wrapper object is created out of the blue so as to pass it to the web service as the lone parameter encapsulating the Team data type.

By looking at the WSDL, we can determine how to “instantiate” Team and Mascot data types on the client side. For example, to create a Team data type and assign it’s name property to “toronto”, we simply refer to it using associative array syntax and both the Team object and it’s property name are created “on the fly”. There’s no mucking around with namespaces etc. We’re simply wrapping the primitives inside other PHP “objects” using the same syntax as associative arrays. You can go as deep as you want in the object hierarchy in PHP without having to worry about encountering nulls because if an array element being accessed doesn’t exist, it is created for you.

It’s also always a good idea to use the $client->__getTypes() and do a print_r(..) on the results to see what you are dealing with before you start communicating with a WSDL For example, the result of a print_r($client->__getTypes()) on the above WSDL returned the following:

Array (
   [0] => struct Team { string name; }
   [1] => struct Mascot { string name; }
   [2] => struct getMascot { Team team; }
   [3] => struct getMascotResponse { Mascot out; }
)

As you can see this information can be helpful when deciding how to initialize your client side variables.

Note that you can also use $client->getMascot($wrapper) instead of $client->__soapCall(”getMascot”, array($wrapper)). The latter is used mostly when passing extra parameters such as SOAP headers etc.

This is a fairly simple example which hopefully illustrated the point that accessing web services using PHP is not a daunting task, and most of all there are no additional libraries to install as long as you’re using PHP5 and up.  If you would like write a PHP client that accesses a WS-Security enabled service, you should read Kim Cameron’s IdentityBlog entry which has links to the source code needed.

Posted in java, php, web, web services | 2 Comments »