1

Re: Migrating AJAX web-services from version 3.4 to 3.5

Having just spent a frustrating day migrating some AJAX web services from 3.4 to 3.5 I thought I'd share my findings in case anyone else needs to do the same, or can re-educate me...

The fixupxml function mentioned in http://forums.nbn.org.uk/viewtopic.php?id=972 #7 now simplifies to

function fixupxml($xml)
    {
    $pos = strpos($xml,'<?xml');            // Find the start of the <?xml tag
    $xml = substr($xml,$pos);               // Discard everything before it
    return $xml;
    }

It now seems necessary to include the new namespace parts in the queries e.g. <dat:DatasetList> instead of <DatasetList>. These are documented at http://data.nbn.org.uk/Documentation/Web_Services/Web_Services-SOAP/

Parsing the returned XML in Javascript seems to require use of the name spaces to find elements, e.g.

    var x = xmlDoc.getElementsByTagName("ns3:Species");

instead of

    var x = xmlDoc.getElementsByTagName("Species");

which is what I used before. What I can't find though is any documentation on this. The website documentation, e.g. http://data.nbn.org.uk/Documentation/Web_Services/Web_Services-SOAP/Actual_Services/Species_List/ makes no mention of this - there are no namespaces in the example XML responses. Its seems necessary to print out the returned responses in order to discover what they are. They are numeric, so can't be guessed, unlike those in the requests which follow a logical naming. Am I doing something wrong as this doesn't seem right. I fear the numbers will change as soon as I've got all my code working again...!

I found that "Purpose" has changed to "DatasetPurpose" in the dataset Abstract.

I looked for documentation on changes between 3.4 and 3.5 and how to migrate, but couldn't find any on the website. Did I miss it?

I still have more code to migrate, so may find other things. If I've taken a wrong turn in any of the above can someone please let me know before I go too far in the wrong direction. Thanks.

Regards, Keith

2

Re: Migrating AJAX web-services from version 3.4 to 3.5

Another oddity with 3.5:

When I do a 'map:GridMapRequest ' with map:Background set to 'ViceCounty' and map:ViceCounty set to 30, the returned map has two similar, but different, VC30 boundaries on it - one bold and one feint. They don't overlay.

With version 3.4 with the same request I only get the bold boundary.

Why are Vice-County boundaries web-service version dependent?

Regards, Keith

3

Re: Migrating AJAX web-services from version 3.4 to 3.5

Keith,

There should be no difference in VC boundaries, can you please post an example query so we can fix this issue.

I'm sorry you are having issues with porting from 3.4 to 3.5. Which SOAP library are you using?

Paul

Paul Gilbertson,
NBN Gateway Developer

4 (edited by kbalmer 02-02-2012 18:14:54)

Re: Migrating AJAX web-services from version 3.4 to 3.5

Hi Paul,

Here is the version 3.5 request which returns the odd VC boundaries. (The extra "-"s and carriage returns aren't in the query - that's just the debugger script/browser/something putting them in...).

-<map:GridMapRequest xmlns:map="http://www.nbnws.net/Map" xmlns:tax="http://www.nbnws.net/Taxon" xmlns:dat="http://www.nbnws.net/Dataset" xmlns:spat="http://www.nbnws.net/Spatial" xmlns:sit="http://www.nbnws.net/SiteBoundary" registrationKey="a85d4c129728e58da6ed1b9af84632e15e2b5927">
-<tax:TaxonVersionKey>
NHMSYS0000080161
</tax:TaxonVersionKey>
-<dat:DatasetList>
-<dat:DatasetKey>
GA000458
</dat:DatasetKey>
</dat:DatasetList>
-<map:Resolution>
_2km
</map:Resolution>
-<map:GridMapSettings>
-<map:Width>
350
</map:Width>
-<map:Height>
550
</map:Height>
-<map:Grid>
Grid_10km
</map:Grid>
-<map:Background>
ViceCounty
</map:Background>
-<map:ViceCounty>
30
</map:ViceCounty>
-<map:Region>
GBIreland
</map:Region>
</map:GridMapSettings>
-<map:Classification>
<map:Band from="2000" to="2020" fill="#FF0000" border="#000000" />
<map:Band from="1990" to="1999" fill="#FFFF00" border="#000000" />
<map:Band from="1800" to="1989" fill="#0000FF" border="#000000" />
</map:Classification>
</map:GridMapRequest>

This is the returned map with its ghostly additional VC
[img]http://www.bedscape.org.uk/debug/gridGBv4_nbnims-2508444489312.gif[/img]

Here's the same map using version 3.4:
[img]http://www.bedscape.org.uk/debug/gridGBv4_nbnims-2508426009300.gif[/img]

Regarding the web-site documentation I now note that some example XML responses include the ns#: namespaces (e.g. for GridMap) but others don't (e.g. SpeciesList). Neither example response appears to match the diagrams above them which suggest the namespaces should be like taxon:, map:, dataset: rather thand the ns1:, ns2:, ns3: etc. actually returned.

The changelog with my soap files suggests it is "2007-10-31, version 0.7.2", which seems rather old given that the current version appears to be 1.2.  (Not sure how I got one that old - I probably followed a link in an old tutorial). I can upgrade if that will make a difference.

Regards, Keith

5

Re: Migrating AJAX web-services from version 3.4 to 3.5

Thanks Keith, the ghosting is a simplified background layer that seems to have been turned on by accident. A bugfix is due out soon, I'll keep you informed.

On the documentation issue, I'll add it to our task list to revising the documentation again. The namespaces issue is something that should be handled invisibly by the SOAP client, but clearly there is at least one client out there that fails to follow standards.

Paul Gilbertson,
NBN Gateway Developer