Exclusive details on the DDI API (not a repeat...)

I am getting an application error when accessing the Webservice. Typical .NET error if the custom errors aren't set up.

Is it currently down or inaccessible, or is the webservice itself not working unless you are logged in?

I have logged into the DDI and then in a different browser tab, gone directly to the webservice and used the KeywordSearch method with keywords="Human Guard" and tab="Monster". Even trying an HTTP GET and I get the same error.
 

log in or register to remove this ad

You don't need to be logged in to perform searches.

Double check and make sure the service is actually working. I've found it has a knack for noticing when I want to work on a program and it decides to stop working for a while. :/
 

As it turns out the WSDL the webservice has tied to it, brings back incorrect URLs for the service.

Code:
  <wsdl:service name="CompendiumSearch">
    <wsdl:port name="CompendiumSearchSoap" binding="tns:CompendiumSearchSoap">
      <soap:address location="http://www.wizards.com/compendiumsearch.asmx" />
    </wsdl:port>
    <wsdl:port name="CompendiumSearchSoap12" binding="tns:CompendiumSearchSoap12">
      <soap12:address location="http://www.wizards.com/compendiumsearch.asmx" />
    </wsdl:port>
    <wsdl:port name="CompendiumSearchHttpGet" binding="tns:CompendiumSearchHttpGet">
      <http:address location="http://www.wizards.com/compendiumsearch.asmx" />
    </wsdl:port>
    <wsdl:port name="CompendiumSearchHttpPost" binding="tns:CompendiumSearchHttpPost">
      <http:address location="http://www.wizards.com/compendiumsearch.asmx" />
    </wsdl:port>
  </wsdl:service>
 

Good call, catsclaw. I was able to get it working by specifying the address myself, e.g.

Code:
var c = new CompendiumSearch.CompendiumSearchSoapClient("CompendiumSearchSoap12", @"http://www.wizards.com/dndinsider/compendium/compendiumsearch.asmx");
 

Yea, I ended up doing that too.

Also, playing around with the API without creating a webreference to the DDI service, I also used a simple approach and just loaded the url into an XDocument. Then I can easily traverse the monsterlist with Linq to Xml.

Code:
    XDocument monsterXml = GetSearchResults("http://www.wizards.com/dndinsider/compendium/CompendiumSearch.asmx/KeywordSearch?Keywords=Human+Guard&tab=Monster")


    public XDocument GetSearchResults(string url)
    {
        XDocument resultsXml = new XDocument();
        try
        {
            resultsXml = XDocument.Load(url);
        }
        catch (Exception e)
        {
            throw e;
        }
        return resultsXml;
    }
 
Last edited:

I am using the API to be able to take the monster data and convert it into a fully functional rptok file for MapTools and the 4e framework I am using (Rumble's).

Still, it's a work in progress, and I am hesitant to write an HTML parser for the monster.aspx page because they are likely going to release the individual elements (like monster) API soon and I don't want to waste too much time writing a throw-away.
 

Hey, great thread! Any ideas on a general place to talk about DDI Api?
Seems like there are a number of interested D&D player/programmers out here, it would be nice to have a place for the hobbyist to share ideas.

It looks like they've added a needed NameOnly parameter, which I've just been setting to "false".

Thanks very much to Asmor's examples, I got a simple ruby client working.

For the interested, this requires the excellect xml-object and restclient gems, but once those are ready, getting an implicit object model that allows you to deal with the meat of the data is dead simple:

Code:
xml = RestClient.get('http://www.wizards.com/dndinsider/compendium/CompendiumSearch.asmx/KeywordSearch?Keywords=mind+flayers&tab=Monster&NameOnly=false')
data = XMLObject.new(xml) # That's it! Gives us a model implicitly!

# get each monster and show some data
data.Results.Monster.each do |monster|
  puts "#{monster.Name} is found in #{monster.SourceBook}"
  # do something more interesting, like put into a ul in HTML
end

The results for this look like this:

Mind Flayer Infiltrator is found in Monster Manual
Mind Flayer Mastermind is found in Monster Manual
 

I hope I don't get lynched for Thread-romancy, but is this mechanism still valid and still alive? I've been trying it recently and all I get are 500-errors.

If not, is there a more up to date mechanism? This whole topic is amazingly difficult to find useful, up to date and correct info about...

Cheers
Blakey
 

Remove ads

Top