ColdFusion/Sharepoint Integration - Part 1 - Authenticating
I've been working a bit with Sharepoint lately for some team sites at work and needed a way to dynamically manage some user lists for a given site. Since Sharepoint has a pretty extensive API for interacting with the various bits I figured it would be pretty simple to create a scheduled task in ColdFusion that would pull a list of valid userid from my database and pass the list to Sharepoint to keep the authentication up to date without much intervention on my behalf.
Turns out it wasn't quite all that simple to even connect to the Sharepoint service. My attempts at setting/passing my NT credentials on the webservice call kept resulting in a 401 (Unauthorized) response from the service. Eventually I came across this post from Tom Jordahl that presented a fix. Let me quote Tom's post since he does a good job explaining:
Someone asked me how they could turn on NT Authentication for web service using Apache Axis (the web service used by ColdFusion). By default Axis uses its own HTTP client code, org.apache.axis.transport.http.HTTPSender, to send the XML/SOAP POST requests to a web service. This uses HTTP 1.0 and generally works file.Axis also supports the Jakarta Commons HTTPClient library, and has since 1.0. To configure Axis to use this instead of its own library you must edit the client-config.wsdd file used by Axis. It gets found on the classpath and generally you don't actually have one and the one built in to axis.jar gets used. The interesting line is the http transport. To switch Axis to use the HTTPClient jar, you would change this:
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"></transport>To this:<transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"></transport>Once you have this code configured, Axis will use the HTTPClient library for it HTTP needs. Since the HTTPClient library supports NT Authentication, you just set the username/password on the Stub object as you would normally do for (say) Basic Authentication and it will just work. If you are talking to a .NET web service, you are done.
So as he says, I made the change and "it just worked". I can now interact with the Sharepoint user service. Honestly, I haven't done a thing other then confirm that I can now authenticate at this point. Which is why I named this 'Part 1' - because I have a sinking suspicion that my journey to CF/Sharepoint enlightenment will have a few other bumps along the way.
As a side note, I am a bit unhappy that I had to mod the client-config.wsdd file to get this to work. If anyone knows of a simpler workaround please let me know.



There are no comments for this entry.
[Add Comment]