Here is an old topic that I get a lot of emails about it. About a year or so ago I wrote a cocoa app to get tv listings from SchedulesDirect (formally zap2it datadirect). While writing this application I learned more about cocoa especially WebServices than I had expected. For one thing WebServicesCore is very poorly documented and a bear to understand -it is almost as if someone gave up on the project and moved on to something else. WebServicesCore is not a pure cocoa solution it is a bit low level, core foundation (c based) implementation. It uses CFNetwoks for authentication. However, the service is fully functional and pretty robust once you get the hang of it. When I say robust, I mean for my purpose. My use of WebServiceCore was to access a soap service, send a soap envelope with a request, and download to a file. The completed soap request simply put the file on the local machine so that my program could parse it for the tv listings. The one positive thing about WebServicesCore is that it comes with a small program called WSMakeStubs which will generate code stubs to include in your cocoa project. Simply point it to a WSDL file and it will create files in either core foundation or applescript. The following is a general rundown of what WebCoreServices does:
- Creates a soap request
- Invokes soap request
- Get HTTP authorization request
- Invoke Soap request
Here is a little tidbit of information about WebServicesCore.
- Under Xcode 2.x the header files are located under the foundation framework. However, in Xcode 3.0 it is now under the CoreServices frameworks.
- For more information on WebServicesCore topic visit Todd Ditchendorf,s Blog. I have never meet this person but this is an area he seems to be an expert.
A different approach I learned a little later on that for a simple download request from a soap server I could use a pure cocoa implementation URL Loading System. By using NSURL I could simply create a soap envelope with [NSString stringWithFormat] and send it along to get the file. However a word of caution, this is not good for lets say a flickr web service or a similar sites. It is just to slow. Works still the same for download request. I find this method to be quite simple and fast for my purposes. A Brief rundown of Using NSURL
- Get HTTP authentication challenge
- send soap request
For more information on using Cocoa’s URL loading system see the URL Loading System Programming Guide.
There are other software options that provide code stubs for WebServies