MSN released a new search API. In release notes, it says that Microsoft Visual Studio and the Microsoft .NET framework are required. Unsurprisingly, this is not right. With a few modifications to the wsdl file, MSN’s API can be used with Java.
After downloading the MSN Search SDK, go into
WindowsSearchFormVB\Web References\MSNSearch\webservices.wsdl*
Open the wsdl file and delete the tags < xsd:list > and < xsd:simpleType > under ResultFieldMask and SearchFlags (don’t forget to delete the closing tags). Now you can generate the proper classes using WSDL2Java and use the ResultFieldMask and SearchFlags classes the same way you’d use the SourceType class.
Make sure when you edit the wsdl file, you keep the encoding in UTF-8. Some text editors will put non-utf-8 encoded characters, and you’ll get a parsing error when trying to generate the classes using Apache Axis. One way to keep the encoding in UTF-8 is to make the changes in Microsoft Word, and save the file as encoded text. From there you can choose UTF-8 encoding.
Download Apache Axis 1.2, and generate the classes by using this command:
java org.apache.axis.wsdl.WSDL2Java -p com.msn.search.soap
c:\webservices.wsdl (or whatever the path of your wsdl file is).
Here is an example of a simple class that tries to find a URL’s rank. A couple of important notes: you can only get 50 results at a time, and you can not get results from source requests of the same source type.
Using MSN’s API with Coldfusion
It is easy to use MSN’s web services with Coldfusion by creating a web service object. Here is example code that processes a form query to create a Coldfusion structure that will display results from the search method.
Conclusion
You don’t need to know visual basic, c#, or anything .NET to use MSN’s API. If you have any questions about programming with MSN’s API, ask us! We’ll give you a reply.
*The location of the wsdl file has changed since the time of this article. Look for the “web references” folder and you should be able to get to the wsdl file.










