Extension talk:Biblio

From mediawiki.org
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

From now on, please put your remarks and questions at http://wikiomics.org/wiki/Talk:Biblio because it allows email notifications, so I will get notified if you add anything. Besides, the latest version is installed there, so it makes testing easier. Thank you. --Martin Jambon 21:12, 6 July 2006 (UTC)Reply[reply]

The existing discussion has been moved already.

Bill Flanagan at openwetware.org: There's a problem related to accessing Pubmed via a SOAP web service in the current version of Biblio that I've fixed. Unfortunately, my fix involves no change to the Biblio extension itself but to both the Nusoap PHP library and to the configuration of the PHP executable on the server. The issue appear to be related to the character-set encoding of the SOAP content delivered from the Pubmed server.


To fix it, I added multibyte character support to my PHP executable and to also make something of a hack in the SOAP library. I am forcing the conversion of the input content to UTF-8 . The problem we had was that any accented, umlauted, or otherwise enhanced characters in a single citation was stopping all of citations on a page from being rendered.

I'm going to see if I can get the nusoap mods I've made integrated into the standard package before submitting a final change.

Pubmed Extension[edit]

This problem also affects the Pubmed extension for MediaWiki. I tested it as I tried to debug the problem. As a matter of fact it affects anyone trying to render citation via PHP coming from Pubmed using NuSoap. I don't test the built-in PHP Soap extension.


Martin Jambon has not been supporting Biblio. I've made a number of enhancements and will release a new version when the Nusoap issue is resolved.

For more information or questions, you can contact me here or send mail to bill at openwetware dot org.

"A citation is a terrible thing to waste...."

New Release of Biblio in Test[edit]

A new version of Biblio is forthcoming. NuSOAP has been eliminated entirely from this release. The extension now uses PubMed's REST interface rather than SOAP to retrieve citations. This simplifies the extension and makes it more reliable and efficient. Other bugs have been fixed.

I'll post information as soon as the release has been tested.

Please contact me either here or at OpenWetWare.org with questions, comments, or requests.

Fix of encoding problem[edit]

Until Bill can provide a new tested version of Biblio, the encoding problem can be fixed with the following patch that detects whether the returned XML is in ISO-8859-1, and converts it to UTF-8 only when it's in ISO-8859-1:

--- extensions/nusoap/nusoap.php~
+++ extensions/nusoap/nusoap.php
@@ -5848,6 +5850,9 @@
 		$this->method = $method;
 		$this->decode_utf8 = $decode_utf8;

+		if (mb_detect_encoding($xml, 'ISO-8859-1') == 'ISO-8859-1')
+			$xml = utf8_encode($xml);
 		// Check whether content has been read.
 			// Check XML encoding

--- extensions/Biblio.php~
+++ extensions/Biblio.php
@@ -257,8 +257,12 @@
       new nusoapclient($server_url, true,
 		       $proxyhost, $proxyport,
 		       $proxyusername, $proxypassword);
+    /* $client->soap_defencoding = 'UTF-8'; */
+    /* $client->xml_encoding = 'UTF-8'; */
+    $client->decode_utf8 = false;
     $err = $client->getError();

     if (!$err) {
       $result = $client->call($operation, array('parameters' => $param),
 			      '', '', false, true);

The commented out lines might be necessary later when the PubMed's SOAP server will be fixed to use UTF-8. Link0ff (talk) 02:27, 28 February 2012 (UTC)Reply[reply]

Also the current PHP code issues some warnings that can be fixed with this patch:

--- extensions/Biblio.php~
+++ extensions/Biblio.php
@@ -741,7 +749,7 @@
     if (count($pmids_to_fetch)) {
       $pmdata = $this->eSummary($pmids_to_fetch);
-      $pmerror = $pmdata["ERROR"];
+      $pmerror = isset($pmdata["ERROR"]) ? $pmdata["ERROR"] : "";
       $pmentries1 = $this->FormatPubMed($pmdata);
       foreach ($pmentries1 as $pmid => $value) {
 	$pmentries[$pmid] = $value;

--- extensions/nusoap/nusoap.php~
+++ extensions/nusoap/nusoap.php
@@ -4148,7 +4148,9 @@
 			            foreach ($xs->imports as $ns2 => $list2) {
 			                for ($ii = 0; $ii < count($list2); $ii++) {
 			                	if (! $list2[$ii]['loaded']) {
-			                		$this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
+			                		for ($jj = 0; $jj < count($this->schemas[$ns]); $jj++) {
+			                			$this->schemas[$ns][$jj]->imports[$ns2][$ii]['loaded'] = true;
+			                		}
 			                		$url = $list2[$ii]['location'];
 									if ($url != '') {
 										$urlparts = parse_url($url);