dims 02/03/24 04:08:40
Modified: java/src/org/apache/axis/wsdl WSDL2Java.java
Log:
WSDL2Java and WSDL2JavaAntTask will now work even in the case where the proxy server
needs a user id and password.
java -Dhttp.proxyHost=??? -Dhttp.proxyPort=??? -Dhttp.proxyUser=???
-Dhttp.proxyPassword=??? org.apache.axis.wsdl.WSDL2Java -D -v
http://www.dotnetjunkies.com/services/ContentServices.asmx?WSDL
java -Dhttp.proxyHost=??? -Dhttp.proxyPort=??? -Dhttp.proxyUser=???
-Dhttp.proxyPassword=??? org.apache.tools.ant.Main XXXXXXXXX
Revision Changes Path
1.20 +21 -15 xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java
Index: WSDL2Java.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- WSDL2Java.java 22 Mar 2002 17:21:25 -0000 1.19
+++ WSDL2Java.java 24 Mar 2002 12:08:40 -0000 1.20
@@ -54,33 +54,29 @@
*/
package org.apache.axis.wsdl;
+import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
+import org.apache.axis.encoding.DefaultTypeMappingImpl;
+import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.utils.CLArgsParser;
import org.apache.axis.utils.CLOption;
import org.apache.axis.utils.CLOptionDescriptor;
import org.apache.axis.utils.CLUtil;
import org.apache.axis.utils.JavaUtils;
-
-import org.apache.axis.wsdl.toJava.Emitter;
import org.apache.axis.wsdl.toJava.BaseTypeMapping;
-import org.apache.axis.wsdl.toJava.JavaWriterFactory;
+import org.apache.axis.wsdl.toJava.Emitter;
import org.apache.axis.wsdl.toJava.GeneratedFileInfo;
-import org.apache.axis.encoding.DefaultTypeMappingImpl;
-import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
-import org.apache.axis.encoding.TypeMapping;
-
-import javax.wsdl.QName;
-
+import org.apache.axis.wsdl.toJava.JavaWriterFactory;
import org.w3c.dom.Document;
+import javax.wsdl.Definition;
+import javax.wsdl.QName;
+import javax.wsdl.WSDLException;
import java.io.File;
import java.io.IOException;
-
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
import java.util.HashMap;
import java.util.List;
-import java.util.Date;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
/**
* Command line interface to the wsdl2java utility
@@ -297,7 +293,7 @@
/**
- * Indicate writer factory
+ * Indicate writer factory
* @param String class name
*/
public void factory(String value) {
@@ -460,6 +456,8 @@
public void emit(String wsdlURL)
throws Exception {
+ Authenticator.setDefault(new DefaultAuthenticator());
+
// We run the actual Emitter in a thread that we can kill
WSDLRunnable runnable = new WSDLRunnable(emitter, wsdlURL);
Thread wsdlThread = new Thread(runnable);
@@ -749,4 +747,12 @@
System.exit(1);
}
+ private class DefaultAuthenticator extends Authenticator {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ String proxyUser = System.getProperty("http.proxyUser","");
+ String proxyPassword = System.getProperty("http.proxyPassword","");
+ System.out.println("Authenticator:" + getRequestingPrompt() + "[" +
proxyUser + ":" + proxyPassword + "]");
+ return new PasswordAuthentication (proxyUser,
proxyPassword.toCharArray());
+ }
+ }
}