rineholt 2002/06/08 19:01:11
Modified: java/src/org/apache/axis MessageContext.java
java/src/org/apache/axis/providers/java JavaProvider.java
java/src/org/apache/axis/transport/http AxisServlet.java
SimpleAxisWorker.java
java/test build_functional_tests.xml
java/test/functional TestElementSample.java
Log:
Have TestElementSample use localhost so it matches the WSDL generated by wsdl?
Allow wsdl? feature to be able to target another host/port so one can target
proxies like tcpmon which is helpful to see the actual WSDL generated.
Revision Changes Path
1.98 +11 -0 xml-axis/java/src/org/apache/axis/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- MessageContext.java 4 Jun 2002 22:58:32 -0000 1.97
+++ MessageContext.java 9 Jun 2002 02:01:10 -0000 1.98
@@ -617,6 +617,17 @@
/** The directory where in coming attachments are created. */
public static String ATTACHMENTS_DIR = "attachments.directory" ;
+ /** The value of the property is used by service WSDL generation (aka ?WSDL)
+ * For the service's interface namespace if not set TRANS_URL property is used.
+ */
+ public static String WSDLGEN_INTFNAMESPACE = "axis.wsdlgen.intfnamespace";
+
+ /** The value of the property is used by service WSDL generation (aka ?WSDL)
+ * For the service's location if not set TRANS_URL property is used.
+ * (helps provide support through proxies.
+ */
+ public static String WSDLGEN_SERV_LOC_URL = "axis.wsdlgen.serv.loc.url";
+
/** Just a util so we don't have to cast the result
*/
public String getStrProp(String propName) {
1.58 +23 -2
xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
Index: JavaProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- JavaProvider.java 5 Jun 2002 23:26:07 -0000 1.57
+++ JavaProvider.java 9 Jun 2002 02:01:10 -0000 1.58
@@ -81,6 +81,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
/**
* Base class for Java dispatching. Fetches various fields out of envelope,
@@ -373,6 +374,26 @@
try {
String url = msgContext.getStrProp(MessageContext.TRANS_URL);
+ String interfaceNamespace=
msgContext.getStrProp(MessageContext.WSDLGEN_INTFNAMESPACE);
+ if(interfaceNamespace == null) interfaceNamespace= url;
+ String locationUrl=
msgContext.getStrProp(MessageContext.WSDLGEN_SERV_LOC_URL);
+ if(locationUrl== null) locationUrl= url;
+ else{
+ try{
+ URL urlURL= new URL(url);
+ URL locationURL= new URL(locationUrl);
+ URL urlTemp= new URL( urlURL.getProtocol(),
+ locationURL.getHost(),
+ locationURL.getPort(),
+ urlURL.getFile());
+ interfaceNamespace += urlURL.getFile();
+ locationUrl= urlTemp.toString();
+ }catch(Exception e){
+ locationUrl= url;
+ interfaceNamespace= url;
+ }
+ }
+
Class cls = getServiceClass(msgContext, getServiceClassName(service));
@@ -393,8 +414,8 @@
emitter.setMode(service.getStyle());
emitter.setClsSmart(cls,url);
emitter.setAllowedMethods(allowedMethods);
- emitter.setIntfNamespace(url);
- emitter.setLocationUrl(url);
+ emitter.setIntfNamespace(interfaceNamespace);
+ emitter.setLocationUrl(locationUrl);
emitter.setServiceDesc(msgContext.getService().getInitializedServiceDesc(msgContext));
emitter.setTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry().
getTypeMapping(Constants.URI_DEFAULT_SOAP_ENC));
1.110 +8 -0
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- AxisServlet.java 6 Jun 2002 00:00:01 -0000 1.109
+++ AxisServlet.java 9 Jun 2002 02:01:10 -0000 1.110
@@ -325,6 +325,14 @@
msgContext.setProperty(MessageContext.TRANS_URL, url);
+
+ msgContext.setProperty(MessageContext.WSDLGEN_INTFNAMESPACE,
+ getOption(servletContext,
MessageContext.WSDLGEN_INTFNAMESPACE,url));
+
+ msgContext.setProperty(MessageContext.WSDLGEN_SERV_LOC_URL,
+ getOption(servletContext,
MessageContext.WSDLGEN_SERV_LOC_URL,url));
+
+
boolean wsdlRequested = false;
boolean listRequested = false;
1.3 +6 -0
xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java
Index: SimpleAxisWorker.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleAxisWorker.java 7 Jun 2002 21:36:30 -0000 1.2
+++ SimpleAxisWorker.java 9 Jun 2002 02:01:10 -0000 1.3
@@ -283,6 +283,12 @@
fileName.toString();
msgContext.setProperty(MessageContext.TRANS_URL, url);
+ msgContext.setProperty(MessageContext.WSDLGEN_INTFNAMESPACE,
+ System.getProperty(MessageContext.WSDLGEN_INTFNAMESPACE,url));
+
+ msgContext.setProperty(MessageContext.WSDLGEN_SERV_LOC_URL,
+ System.getProperty(MessageContext.WSDLGEN_SERV_LOC_URL,url));
+
String filePart = fileName.toString();
if (filePart.startsWith("axis/services/")) {
msgContext.setTargetService(filePart.substring(14));
1.46 +9 -1 xml-axis/java/test/build_functional_tests.xml
Index: build_functional_tests.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- build_functional_tests.xml 6 Jun 2002 19:00:42 -0000 1.45
+++ build_functional_tests.xml 9 Jun 2002 02:01:11 -0000 1.46
@@ -23,7 +23,11 @@
<project default="functional-tests" basedir=".">
<property name="test.functional.usefile" value="true"/>
<property name="test.functional.reportdir" value="test-reports"/>
+ <!--The following is the port the service is listening on. -->
+ <!--FYI to run tcpmon change this to another port and have tcpmon listen on 8080
-->
<property name="test.functional.SimpleAxisPort" value="8080"/>
+ <!--The IP port the service will be targeted at.-->
+ <property name="test.functional.ServicePort" value="8080"/>
<property name="test.functional.fail" value="yes"/>
<path id="test-classpath">
@@ -60,7 +64,9 @@
<!-- Uncomment this to use Jikes instead of Javac for compiling JWS Files
<jvmarg value="-Daxis.Compiler=org.apache.axis.utils.compiler.Jikes"/>
-->
- <arg line="-p ${test.functional.SimpleAxisPort}" /> <!-- arbitrary port -->
+ <jvmarg
value="-Daxis.wsdlgen.intfnamespace=http://localhost:${test.functional.ServicePort}"/>
+ <jvmarg
value="-Daxis.wsdlgen.serv.loc.url=http://localhost:${test.functional.ServicePort}"/>
+ <arg line="-p ${test.functional.SimpleAxisPort}" /> <!-- arbitrary port -->
<classpath refid="test-classpath" />
</java>
</target>
@@ -100,6 +106,7 @@
<jvmarg value="-Dhttp.proxyPassword=${http.proxyPassword}"/>
<!-- Pass the port for SimpleAxisServer -->
<jvmarg
value="-Dtest.functional.SimpleAxisPort=${test.functional.SimpleAxisPort}"/>
+ <jvmarg value="-Dtest.functional.ServicePort=${test.functional.ServicePort}"/>
<classpath refid="test-classpath" />
<formatter type="xml" usefile="${test.functional.usefile}"/>
<batchtest todir="${test.functional.reportdir}">
@@ -326,6 +333,7 @@
<jvmarg value="-Dhttp.proxyPassword=${http.proxyPassword}"/>
<!-- Pass the port for SimpleAxisServer -->
<jvmarg
value="-Dtest.functional.SimpleAxisPort=${test.functional.SimpleAxisPort}"/>
+ <jvmarg value="-Dtest.functional.ServicePort=${test.functional.ServicePort}"/>
<classpath refid="test-classpath" />
<formatter type="xml" usefile="${test.functional.usefile}"/>
<batchtest todir="${test.functional.reportdir}">
1.5 +2 -2 xml-axis/java/test/functional/TestElementSample.java
Index: TestElementSample.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/functional/TestElementSample.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestElementSample.java 4 Jun 2002 17:50:37 -0000 1.4
+++ TestElementSample.java 9 Jun 2002 02:01:11 -0000 1.5
@@ -73,8 +73,8 @@
}
public void doTestElement () throws Exception {
- String thisHost = "127.0.0.1";
- String thisPort =
System.getProperty("test.functional.SimpleAxisPort","8080");
+ String thisHost = "localhost";
+ String thisPort = System.getProperty("test.functional.ServicePort","8080");
String[] args = {thisHost,thisPort};
String xml = "<x:hello xmlns:x=\"urn:foo\">a string</x:hello>";