[MOBY-guts] biomoby commit

Paul Gordon gordonp at pub.open-bio.org
Fri Sep 3 20:28:16 UTC 2004


gordonp
Fri Sep  3 16:28:16 EDT 2004
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv10407/src/main/org/biomoby/client

Modified Files:
	MobyRequest.java 
Log Message:
Changes to introduction base data object instance classes (i.e. creating MOBY query data from Java objects, not handcrafted XML)

moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.4,1.5
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2004/07/07 16:02:47	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2004/09/03 20:28:16	1.5
@@ -506,6 +506,24 @@
 	    throw new MobyException("The MOBY payload has no text contents at all"); 
 	}
 
+	// Check if the payload is an XML document.  If not, try a last ditch effort 
+	// by base64 decoding the contents.  This is technically not allowable in the 
+	// MOBY spec, but we are being lenient.
+	if(!responseString.startsWith("<?xml")){
+	    responseString = new String(org.apache.axis.encoding.Base64.decode(responseString));
+	    if(!responseString.startsWith("<?xml")){
+		throw new MobyException("The SOAP payload defining the MOBY contents " +
+					"does not start with <?xml, and is therefore not " +
+					"an XML document, as specified in the MOBY API. " +
+					"Please contact the service provider.  Contents is: " + responseString);
+	    }
+	    debugPS.println("Warning: The MOBY contents was needlessly base64 encoded (the SOAP " +
+			    "envelope does this for you).  It has been decoded, but this is not " +
+			    "part of the MOBY API, and may stop working in the future.  Please " +
+			    "contact the service provider to correct this.");
+	}
+
+
 	Document domDoc = null;
 	try{
 	    domDoc = docBuilder.parse(new StringBufferInputStream(responseString));




More information about the MOBY-guts mailing list