[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Jul 15 18:35:30 UTC 2009


gordonp
Wed Jul 15 14:35:30 EDT 2009
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv25245/src/main/org/biomoby/client

Modified Files:
	MobyRequest.java 
Log Message:
Re-enabled authentication support for HttpURLConnection-based service calls
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.43,1.44
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2009/06/09 19:08:32	1.43
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java	2009/07/15 18:35:30	1.44
@@ -1,8 +1,10 @@
 package org.biomoby.client;
 
 import java.io.*;
-import java.net.URL;
+import java.net.Authenticator; // for HttpURLConnection username/password
 import java.net.HttpURLConnection;
+import java.net.PasswordAuthentication; // for HttpURLConnection username/password
+import java.net.URL;
 import java.util.*;
 
 import javax.xml.namespace.QName;
@@ -549,6 +551,15 @@
 //PG        mobyXMLInputData[0] = mobyInputXML;
 
 	String soapAction = "http://biomoby.org/#" + method;
+	if(user != null && password != null) {
+	    final String login = user;
+	    final String pass = password;
+	    Authenticator.setDefault(new Authenticator() {
+		    protected PasswordAuthentication getPasswordAuthentication() {
+			return new PasswordAuthentication (login, pass.toCharArray());
+		    }
+		});
+	}
 	HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
 	byte[] payload = ("<ns1:"+method+
 			  " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"http://biomoby.org/\">"+




More information about the MOBY-guts mailing list