You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2002/07/17 00:42:52 UTC
cvs commit: xml-axis/java/test/wsdl/roundtrip RoundtripTestServiceTestCase.java
scheu 2002/07/16 15:42:52
Modified: java/docs reference.html
java/src/org/apache/axis/wsdl/fromJava Types.java
java/test/wsdl Java2WsdlAntTask.java Wsdl2javaTestSuite.xml
java/test/wsdl/roundtrip RoundtripTestServiceTestCase.java
Log:
The following changes are made:
1) Added documentation describing the new Java2WSDL --input and --bindingName options.
2) Made a small fix to Java2WSDL Types found while constructing a testcase.
3) Extended the roundtrip testcase to test the new options. Java2WSDL is now called
an extra time to add a second port to the WSDL file (named RoundtripTripTest2). The
second port uses the same binding as the orginal port. A new test method is added
(testStockInvestmentWithPort2) to verify that the second port was created successfully
and deployed properly.
Cool!
Revision Changes Path
1.6 +22 -4 xml-axis/java/docs/reference.html
Index: reference.html
===================================================================
RCS file: /home/cvs/xml-axis/java/docs/reference.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- reference.html 28 Jun 2002 18:00:30 -0000 1.5
+++ reference.html 16 Jul 2002 22:42:51 -0000 1.6
@@ -237,6 +237,10 @@
<br>
<tt><font color="#993366">
print this message and exit</font></tt> <br>
+ <tt><font color="#993366"> -I, --input
+ <argument></font></tt> <br>
+ <tt><font color="#993366">
+ input WSDL filename</font></tt> <br>
<tt><font color="#993366"> -o, --output
<argument></font></tt> <br>
<tt><font color="#993366">
@@ -250,6 +254,11 @@
<tt><font color="#993366">
portType name (obtained from class-of-portType if not specified)</font></tt>
<br>
+ <tt><font color="#993366"> -b, --bindingName
+ <argument></font></tt> <br>
+ <tt><font color="#993366">
+ binding name ((--servicePortName value + "SOAPBinding" if not specified)</font></tt>
+ <br>
<tt><font color="#993366"> -S, --serviceElementName
<argument></font></tt> <br>
<tt><font color="#993366">
@@ -327,8 +336,8 @@
<tt><font color="#993366">Details:</font></tt> <br>
<tt><font color="#993366"> portType element name= <.portTypeName
value> OR <class-of-portType name></font></tt> <br>
- <tt><font color="#993366"> binding element name= <--servicePortName
- value>SoapBinding</font></tt> <br>
+ <tt><font color="#993366"> binding element name= <--bindingName value> OR
+ <--servicePortName value>SoapBinding</font></tt> <br>
<tt><font color="#993366"> service element name= <--serviceElementName
value> OR <portTypeName value>Service</font></tt> <br>
<tt><font color="#993366"> port element name=
@@ -341,6 +350,12 @@
<p><b>-o, --output <WSDL file></b> <br>
Indicates the name of the output WSDL file. If not specified, a suitable
default WSDL file is written into the current directory.
+<p><b>-i, --input <WSDL file></b> <br>
+ Optional parameter that indicates the name of the input wsdl file. The output
+ wsdl file will contain everything from the input wsdl file plus the new constructs.
+ If a new construct is already present in the input wsdl file, it is not added.
+ This option is useful for constructing a wsdl file with multiple ports, bindings,
+ or portTypes.
<p><b>-l, --location <location></b> <br>
Indicates the url of the location of the service. The name after the last
slash or backslash is the name of the service port (unless overriden by the
@@ -349,10 +364,13 @@
<p><b>-p, --portTypeName <name></b> <br>
Indicates the name to use use for the portType element. If not specified, the
class-of-portType name is used.
-<p><b>-s, -serviceElementName <name></b> <br>
+<p><b>-b, --bindingName <name></b> <br>
+ Indicates the name to use use for the binding element. If not specified, the
+ value of the --servicePortName + "SoapBinding" is used.
+<p><b>-s, --serviceElementName <name></b> <br>
Indicates the name of the service element. If not specified, the service
element is the <portTypeName>Service.
-<p><b>-s, -servicePortName <name></b> <br>
+<p><b>-s, --servicePortName <name></b> <br>
Indicates the name of the service port. If not specified, the service
port name is derived from the --location value.
<p><b>-n, --namespace <target namespace></b> <br>
1.46 +2 -2 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
Index: Types.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- Types.java 16 Jul 2002 18:32:46 -0000 1.45
+++ Types.java 16 Jul 2002 22:42:51 -0000 1.46
@@ -211,10 +211,10 @@
for (int i=0; i < v.size(); i++) {
TypeEntry te = (TypeEntry) v.elementAt(i);
if (te instanceof org.apache.axis.wsdl.symbolTable.Element) {
+ addToElementsList(te.getQName());
+ } else if (te instanceof Type) {
addToTypesList(te.getQName(),
te.getQName().getLocalPart());
- } else if (te instanceof Type) {
- addToElementsList(te.getQName());
}
}
1.15 +32 -5 xml-axis/java/test/wsdl/Java2WsdlAntTask.java
Index: Java2WsdlAntTask.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Java2WsdlAntTask.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Java2WsdlAntTask.java 21 Jun 2002 22:25:38 -0000 1.14
+++ Java2WsdlAntTask.java 16 Jul 2002 22:42:51 -0000 1.15
@@ -78,10 +78,12 @@
private String location = "";
private String locationImport = null;
private String output = "." ;
+ private String input = null ;
private String outputImpl = null;
private String className = "." ;
private String servicePortName = null ;
private String portTypeName = null ;
+ private String bindingName = null ;
private String implClass = null;
private boolean useInheritedMethods = false;
private String exclude = null;
@@ -97,7 +99,11 @@
log("\tPkgtoNS:" + namespaceMap, Project.MSG_VERBOSE);
log("\tlocation:" + location, Project.MSG_VERBOSE);
log("\toutput:" + output, Project.MSG_VERBOSE);
+ log("\tinput:" + input, Project.MSG_VERBOSE);
log("\tclassName:" + className, Project.MSG_VERBOSE);
+ log("\tservicePortName:" + servicePortName, Project.MSG_VERBOSE);
+ log("\tportTypeName:" + portTypeName, Project.MSG_VERBOSE);
+ log("\tbindingName:" + bindingName, Project.MSG_VERBOSE);
log("\timplClass:" + implClass, Project.MSG_VERBOSE);
log("\tinheritance:" + useInheritedMethods, Project.MSG_VERBOSE);
log("\texcluded:" + exclude, Project.MSG_VERBOSE);
@@ -114,18 +120,26 @@
if (!namespaceMap.isEmpty()) {
emitter.setNamespaceMap(namespaceMap);
}
- if (servicePortName != null)
+ if (servicePortName != null) {
emitter.setServicePortName(servicePortName);
- if (portTypeName != null)
+ }
+ if (portTypeName != null) {
emitter.setPortTypeName(portTypeName);
+ }
+ if (bindingName != null) {
+ emitter.setBindingName(bindingName);
+ }
log("Java2WSDL " + className, Project.MSG_INFO);
emitter.setCls(className);
- if (implClass != null)
+ if (implClass != null) {
emitter.setImplCls(implClass);
- if (exclude != null)
+ }
+ if (exclude != null) {
emitter.setDisallowedMethods(exclude);
- if (stopClasses != null)
+ }
+ if (stopClasses != null) {
emitter.setStopClasses(stopClasses);
+ }
if (tm.equals("1.1")) {
emitter.setDefaultTypeMapping(DefaultTypeMappingImpl.getSingleton());
@@ -139,6 +153,9 @@
emitter.setMode(Emitter.MODE_RPC);
}
}
+ if (input != null) {
+ emitter.setInputWSDL(input);
+ }
emitter.setIntfNamespace(namespace);
emitter.setImplNamespace(namespaceImpl);
emitter.setLocationUrl(location);
@@ -164,6 +181,11 @@
this.output = parameter;
}
+ // The setter for the "input" attribute
+ public void setInput(String parameter) {
+ this.input = parameter;
+ }
+
// The setter for the "outputImpl" attribute
public void setOutputImpl(String parameter) {
this.outputImpl = parameter;
@@ -197,6 +219,11 @@
// The setter for the "portTypeName" attribute
public void setPortTypeName(String parameter) {
this.portTypeName = parameter;
+ }
+
+ // The setter for the "bindingName" attribute
+ public void setBindingName(String parameter) {
+ this.bindingName = parameter;
}
// The setter for the "namespace" attribute
1.113 +12 -0 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
Index: Wsdl2javaTestSuite.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- Wsdl2javaTestSuite.xml 12 Jul 2002 19:40:56 -0000 1.112
+++ Wsdl2javaTestSuite.xml 16 Jul 2002 22:42:51 -0000 1.113
@@ -219,6 +219,18 @@
location="http://localhost:8080/axis/services/RoundtripTest">
<mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
</java2wsdl>
+ <!-- Test adding a second port (RoundtripTest2) to the wsdl file -->
+ <java2wsdl output="build/work/test/wsdl/roundtrip/Roundtrip.wsdl"
+ input="build/work/test/wsdl/roundtrip/Roundtrip.wsdl"
+ portTypeName="RoundtripPortType"
+ servicePortName="RoundtripTest2"
+ bindingName="RoundtripTestSoapBinding"
+ className= "test.wsdl.roundtrip.RoundtripPortType"
+ useInheritedMethods="false"
+ namespace="http://roundtrip.wsdl.test"
+ location="http://localhost:8080/axis/services/RoundtripTest2">
+ <mapping namespace="http://roundtrip.wsdl.test" package="test.wsdl.roundtrip"/>
+ </java2wsdl>
<!-- Delete the intermediate files so we recreate over a clean slate -->
1.15 +42 -0 xml-axis/java/test/wsdl/roundtrip/RoundtripTestServiceTestCase.java
Index: RoundtripTestServiceTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/roundtrip/RoundtripTestServiceTestCase.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- RoundtripTestServiceTestCase.java 21 Jun 2002 14:48:38 -0000 1.14
+++ RoundtripTestServiceTestCase.java 16 Jul 2002 22:42:51 -0000 1.15
@@ -102,6 +102,7 @@
public class RoundtripTestServiceTestCase extends TestCase {
private RoundtripPortType binding = null;
+ private RoundtripPortType binding2 = null;
private static final double DOUBLE_DELTA = 0.0D;
private static final float FLOAT_DELTA = 0.0F;
@@ -123,6 +124,7 @@
try {
binding = new RoundtripPortTypeServiceLocator().getRoundtripTest();
+ binding2 = new RoundtripPortTypeServiceLocator().getRoundtripTest2();
} catch (ServiceException jre) {
fail("JAX-RPC ServiceException caught: " + jre);
}
@@ -173,6 +175,46 @@
} // testStockInvestment
+ /**
+ * Like the above test, but uses the alternate port.
+ */
+ public void testStockInvestmentWithPort2() {
+
+ try {
+ StockInvestment stock = new StockInvestment();
+ stock.setName("International Business Machines");
+ stock.setId(1);
+ stock.setTradeExchange("NYSE");
+ stock.setLastTradePrice(200.55F);
+ float lastTradePrice = binding2.getRealtimeLastTradePrice(stock);
+ assertEquals("The expected and actual values did not match.",
+ 201.25F,
+ lastTradePrice,
+ FLOAT_DELTA);
+ // Make sure static field dontMapToWSDL is not mapped.
+ try {
+ Method m = (StockInvestment.class).
+ getDeclaredMethod("getDontMapToWSDL",
+ new Class[] {});
+ fail("Should not map static member dontMapToWSDL");
+ } catch (NoSuchMethodException e) {
+ // Cool the method should not be in the class
+ }
+
+ // Make sure private field avgYearlyReturn is not mapped.
+ try {
+ Method m = (StockInvestment.class).
+ getDeclaredMethod("getAvgYearlyReturn",
+ new Class[] {});
+ fail("Should not map private member avgYearlyReturn");
+ } catch (NoSuchMethodException e) {
+ // Cool the method should not be in the class
+ }
+ } catch (RemoteException re) {
+ fail("Remote Exception caught: " + re);
+ }
+
+ } // testStockInvestmentWithPort2
/**
* Test to insure that a JAX-RPC Value Type works correctly. PreferredStockInvestment