[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Tue Nov 21 21:03:49 UTC 2006
gordonp
Tue Nov 21 16:03:48 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv16310/src/main/org/biomoby/client
Modified Files:
MobyRequest.java
Log Message:
Made code more lenient about receiving MOBY payloads without XML declarations (to accomodate Taverna's bug)
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.20,1.21
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2006/10/25 02:33:23 1.20
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2006/11/21 21:03:48 1.21
@@ -622,17 +622,28 @@
// by base64 decoding the contents. This is technically not allowable in the
// MOBY spec, but we are being lenient.
if(!localResponseString.startsWith("<?xml")){
- localResponseString = new String(org.apache.axis.encoding.Base64.decode(localResponseString));
- if(!localResponseString.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: " + localResponseString);
- }
- 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.");
+ // Is the XML declaration missing?
+ if(localResponseString.startsWith("<moby:MOBY") || localResponseString.startsWith("<MOBY")){
+ localResponseString = "<?xml version=\"1.0\"?>\n"+localResponseString;
+ debugPS.println("Warning: The MOBY contents was missing an XML declaration, but it is " +
+ "required by the MOBY API, and may stop working in the future without it. Please " +
+ "contact the client's provider to correct this.");
+ }
+ else{
+ String oldResponse = localResponseString;
+ localResponseString = new String(org.apache.axis.encoding.Base64.decode(localResponseString));
+ if(!localResponseString.startsWith("<?xml")){
+ throw new MobyException("The SOAP payload defining the MOBY contents " +
+ "does not start with the xml processing instruction, and is therefore not " +
+ "an XML document, as specified in the MOBY API. " +
+ "Please contact the service provider. Contents was: " +
+ oldResponse);
+ }
+ 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.");
+ }
}
// A bit of a hack: most MOBY data represented in string form
More information about the MOBY-guts
mailing list