Beta XML Interface

Request amendments or pass comments on this free service.
John Upham
Posts: 4129
Joined: Wed Apr 04, 2007 10:29 am
Location: Cove, Hampshire, England.
Contact:

Re: Beta XML Interface

Post by John Upham » Mon Jul 06, 2009 10:19 am

So is
Service and Hosting provided by Blue Apricot Consulting
true for


http://www.dulwichchessclub.org.uk/gradings.php

I feel as though I have been mid-led (even though I understand what is happening technically) :D

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Mon Jul 06, 2009 10:22 am

Nothing to do with me - looks like just a page copy upon further inspection rather than an iframe, oh well :roll:
Cheers
Carl Hibbard

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Mon Jul 06, 2009 5:55 pm

Brent Smith wrote:I don't give up that easy however, so its on to the JavaScript / AJAX version, and possibly working out the underlying XML over HTTP (which I presume the SOAP interface is just a wrapper for). Note to self: must get this done before new grading list is published.
Yes sorry about that - since the Grading site and the new XML interface are all done as total freebies there is a limit to the amount of work people actually want to put in :oops:
Cheers
Carl Hibbard

Ian Kingston
Posts: 1070
Joined: Sat Apr 14, 2007 3:16 pm
Location: Sutton Coldfield
Contact:

Re: Beta XML Interface

Post by Ian Kingston » Mon Jul 06, 2009 6:03 pm

Carl

Re the West Nottingham site: I'll stick a copyright notice on the relevant page as soon as I can - probably tomorrow.

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Mon Jul 06, 2009 6:41 pm

Ian Kingston wrote:Carl

Re the West Nottingham site: I'll stick a copyright notice on the relevant page as soon as I can - probably tomorrow.
Not a big issue, honest!
Cheers
Carl Hibbard

Brent Smith
Posts: 36
Joined: Fri Oct 24, 2008 10:58 pm
Location: Reading
Contact:

Re: Beta XML Interface

Post by Brent Smith » Mon Jul 06, 2009 11:00 pm

Carl Hibbard wrote:
Brent Smith wrote:I don't give up that easy however, so its on to the JavaScript / AJAX version, and possibly working out the underlying XML over HTTP (which I presume the SOAP interface is just a wrapper for). Note to self: must get this done before new grading list is published.
Yes sorry about that - since the Grading site and the new XML interface are all done as total freebies there is a limit to the amount of work people actually want to put in :oops:
It's a shame the SOAP interface is not available to me, because it looks very promising. I got the AJAX version to work by installing Firefox 3.5. However, it didn't work with IE8 (at least not for me). I also tried to use HTTP directly, but kept getting a "SOAP-ENV:Client Bad Request" error. There are so many possible reasons why this didn't work, but the generic error message doesn't enable me to drill any further. I'm not clear how the AJAX method works but the test HTTP page I wrote does not - prob my fault in some way.

My plan was to update some attributes for the players in my database (their ECF grade basically) as a batch job. The AJAX approach could be used, but it doesn't seem much of an improvement on my current method (download CSV file for given club, the upload to PHP script). If I could get the HTTP-based method to work, that would be a more natural solution.

John Upham
Posts: 4129
Joined: Wed Apr 04, 2007 10:29 am
Location: Cove, Hampshire, England.
Contact:

Re: Beta XML Interface

Post by John Upham » Tue Jul 07, 2009 12:11 am

Brent,

I was going to look at this as part of the bundle of enhancements for my League Management solution. Maybe you could get there first and save me the trouble!

We must meet up sometime soon! :D

Brent Smith
Posts: 36
Joined: Fri Oct 24, 2008 10:58 pm
Location: Reading
Contact:

Re: Beta XML Interface

Post by Brent Smith » Sun Jul 12, 2009 11:56 pm

Brent Smith wrote:It's a shame the SOAP interface is not available to me, because it looks very promising. I got the AJAX version to work ... yada, yada yada
Bad form I know to reply to my own posting, but as an update, I have managed to get the interface to work without using the SoapClient class. It's possible to use fopen() with a URL as the "file name", and some POST data, and get the output as a stream. The stream can simply be assigned to a variable which (since it contains an XML document) can then be read using your favourite PHP functions for handling XML (thankfully, most of these are part of the standard distribution). If people feel it would be useful, I could post the final PHP script once I've completed the XML bit.

John Upham
Posts: 4129
Joined: Wed Apr 04, 2007 10:29 am
Location: Cove, Hampshire, England.
Contact:

Re: Beta XML Interface

Post by John Upham » Mon Jul 13, 2009 1:21 am

Brent,

Good stuff! Please post the code. :D

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Mon Jul 13, 2009 7:17 am

The interface on the live site may be delayed a couple of days after the 2009 list is released as normally I don't get a lot of warning or time to get the information published on the site :!:
Cheers
Carl Hibbard

Brent Smith
Posts: 36
Joined: Fri Oct 24, 2008 10:58 pm
Location: Reading
Contact:

Re: Beta XML Interface

Post by Brent Smith » Fri Jul 17, 2009 12:00 am

John Upham wrote:Brent,

Good stuff! Please post the code. :D
I tried to attach it to this post, but failed (file extensions php, txt and blank all rejected :( - Carl, tell me why! ), so have added the actual code within this message. It works from my local client PC, and from one website I support which uses PHP/mySQL, but fails on another one (hosted by a different ISP, with whom I have lodged a query), so I can't promise it will work for everyone. The sample code gets all the "Berkshire Junior" players.

--- start of PHP code ...
<?php
$url = 'http://testgrading.bcfservices.org.uk/gradedata.php'; // - will need to change for live use!

$params = array('http' => array(
'method' => 'POST',
'content' => '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:n="urn:EnglishChess_GradeData">
<s:Body><n:getByClub><Name>Berkshire Junior</Name></n:getByClub></s:Body>
</s:Envelope>'
));
// By setting above content string appropriately (actually, just the s:Body element needs to be set),
// the various methods of the remote object can in effect be invoked.
// In above case, a search for players for a given club name is performed.

// create a stream object...
$ctx = stream_context_create($params);

// use of stream object as final param to fopen indicates that a HTTP post is to be done
// (at least, I think that's how it hangs together)
$fp = @fopen($url, 'r', false, $ctx); // the @ apparently means don't report any warnings
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}

// save entire response stream into a string variable.
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}

// There are seemingly several ways to read XML input. I've used this approach simply because
// it's familiar to me dealing with the DOM in javascript.
$doc = new DOMDocument();
if ($doc->loadXML($response) !== FALSE) { // it's a valid XML string!
// Find items (well, player records, but the relevant node elements are named "item"
// in the published gradedata schema). This is somewhat confusing as the document
// node object includes a property also called "item", which I need to use.
$players = $doc->getElementsByTagName('item');

// Not pretty this, but the schema defines most data items as child nodes of the player/item node,
// rather than as attributes of the main node, which would seem more natural to me.
foreach ($players as $player) {
$ECFrefs = $player->getElementsByTagName('ECFref');
$ECFref = $ECFrefs->item(0);
$FirstNames = $player->getElementsByTagName('FirstNames');
$FirstName = $FirstNames->item(0);
$FamilyNames = $player->getElementsByTagName('FamilyName');
$FamilyName = $FamilyNames->item(0);
echo $ECFref->nodeValue . ': ' . $FirstName->nodeValue . ' ' . $FamilyName->nodeValue . '<BR>';
}
}
else {
echo "Not a valid XML doc";
}
?>

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Fri Jul 17, 2009 6:26 am

Brent Smith wrote:I tried to attach it to this post, but failed (file extensions php, txt and blank all rejected :( - Carl, tell me why! )
It's the default within this software were attachments are not allowed unless I change the settings
Cheers
Carl Hibbard

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Tue Jul 21, 2009 2:07 pm

Due to the delay in the official/printed grading release this interface will probably not be released to live until September

Sorry for the delay :!:
Cheers
Carl Hibbard

User avatar
Carl Hibbard
Posts: 5618
Joined: Fri Dec 08, 2006 8:05 pm
Location: Evesham

Re: Beta XML Interface

Post by Carl Hibbard » Thu Sep 10, 2009 8:05 am

Carl Hibbard wrote:Due to the delay in the official/printed grading release this interface will probably not be released to live until September

Sorry for the delay :!:
The interface is back on the test site and as soon as it's approved and working I will promote it to live
Cheers
Carl Hibbard

mleonard
Posts: 18
Joined: Mon Aug 10, 2009 8:41 pm

Re: Beta XML Interface

Post by mleonard » Tue Mar 22, 2011 1:24 pm

What is the status of this SOAP interface?
I can access the test server (e.g. to fetch a list of club names), but I'm not getting any results back for individual players.
If this was put live can you provide the URL/URI?

Locked