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 bu...@apache.org on 2002/01/09 15:08:38 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaServiceImplWriter.java JavaStubWriter.java
butek 02/01/09 06:08:38
Modified: java/src/org/apache/axis/client Service.java
java/src/org/apache/axis/wsdl/toJava
JavaServiceImplWriter.java JavaStubWriter.java
Log:
Two improvements to generated stubs.
1. Changed "new Boolean(true)" to use the static "Boolean.TRUE" for efficiency.
2. If the stub is constructed from the service, it should use that service.
A. In order to accomplish this, the generated service had to be a javax.xml.rpc.Service,
so it could be referenced in the stub in a generic manner, so it now extends
org.apache.axis.client.Service.
B. I removed the "throws JAXRPCException from the Service constructors that
didn't need it. It makes the client code (and our tests) simpler.
Revision Changes Path
1.31 +3 -6 xml-axis/java/src/org/apache/axis/client/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- Service.java 12 Dec 2001 22:54:18 -0000 1.30
+++ Service.java 9 Jan 2002 14:08:37 -0000 1.31
@@ -116,7 +116,7 @@
return( wsdlService );
}
- protected AxisClient getAxisClient() throws JAXRPCException
+ protected AxisClient getAxisClient()
{
return new AxisClient(configProvider);
}
@@ -125,10 +125,8 @@
* Constructs a new Service object - this assumes the caller will set
* the appropriate fields by hand rather than getting them from the
* WSDL.
- *
- * @exception JAXRPCException If there's an error
*/
- public Service() throws JAXRPCException {
+ public Service() {
engine = getAxisClient();
}
@@ -137,8 +135,7 @@
* the ConfigurationProvider which should be used to set up the
* AxisClient.
*/
- public Service(ConfigurationProvider configProvider)
- throws JAXRPCException {
+ public Service(ConfigurationProvider configProvider) {
this.configProvider = configProvider;
engine = getAxisClient();
}
1.2 +2 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
Index: JavaServiceImplWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaServiceImplWriter.java 11 Dec 2001 15:08:47 -0000 1.1
+++ JavaServiceImplWriter.java 9 Jan 2002 14:08:38 -0000 1.2
@@ -97,7 +97,7 @@
*/
protected void writeFileBody() throws IOException {
// declare class
- pw.println("public class " + className + " {");
+ pw.println("public class " + className + " extends org.apache.axis.client.Service {");
// output comments
writeComment(pw, service.getDocumentationElement());
@@ -180,7 +180,7 @@
pw.println();
pw.println(" public " + bindingType + " get" + portName + "(java.net.URL portAddress) {");
pw.println(" try {");
- pw.println(" return new " + stubClass + "(portAddress);");
+ pw.println(" return new " + stubClass + "(portAddress, this);");
pw.println(" }");
pw.println(" catch (org.apache.axis.AxisFault e) {");
pw.println(" return null; // ???");
1.10 +18 -7 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JavaStubWriter.java 4 Jan 2002 22:30:03 -0000 1.9
+++ JavaStubWriter.java 9 Jan 2002 14:08:38 -0000 1.10
@@ -119,23 +119,34 @@
}
pw.println("public class " + className + " extends javax.xml.rpc.Stub implements " + portTypeName + " {");
- pw.println(" private org.apache.axis.client.Service service = null ;");
+ pw.println(" private javax.xml.rpc.Service service = null ;");
pw.println(" private org.apache.axis.client.Call call = null ;");
pw.println();
- pw.println(" public " + className + "(java.net.URL endpointURL) throws org.apache.axis.AxisFault {");
- pw.println(" this();");
+
+ pw.println(" public " + className + "() throws org.apache.axis.AxisFault {");
+ pw.println(" this(null);");
+ pw.println(" }");
+ pw.println();
+
+ pw.println(" public " + className + "(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {");
+ pw.println(" this(service);");
pw.println(" call.setTargetEndpointAddress( endpointURL );");
pw.println(" call.setProperty(org.apache.axis.transport.http.HTTPTransport.URL, endpointURL.toString());");
pw.println(" }");
+ pw.println();
- pw.println(" public " + className + "() throws org.apache.axis.AxisFault {");
+ pw.println(" public " + className + "(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {");
HashSet types = getTypesInPortType(portType);
Iterator it = types.iterator();
pw.println(" try {" );
- pw.println(" service = new org.apache.axis.client.Service();");
- pw.println(" call = (org.apache.axis.client.Call) service.createCall();");
+ pw.println(" if (service == null) {");
+ pw.println(" this.service = new org.apache.axis.client.Service();");
+ pw.println(" } else {");
+ pw.println(" this.service = service;");
+ pw.println(" }");
+ pw.println(" call = (org.apache.axis.client.Call) this.service.createCall();");
while (it.hasNext()) {
writeSerializationInit((TypeEntry) it.next());
@@ -425,7 +436,7 @@
// SoapAction and Namespace
if (soapAction != null) {
- pw.println(" call.setProperty(\"soap.http.soapaction.use\", new Boolean(true));");
+ pw.println(" call.setProperty(\"soap.http.soapaction.use\", Boolean.TRUE);");
pw.println(" call.setProperty(\"soap.http.soapaction.uri\", \"" + soapAction + "\");");
}
pw.println(" call.setProperty(call.NAMESPACE, \"" + namespace