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/03/28 16:21:47 UTC
cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava ClassRep.java Emitter.java MethodRep.java
butek 02/03/28 07:21:47
Modified: java/src/org/apache/axis/wsdl/fromJava ClassRep.java
Emitter.java MethodRep.java
Log:
Fixed bugzilla report #7049. Java2WSDL did not produce proper WSDL
for overloaded Java methods. It needed to give the input/output stanzas
names.
Revision Changes Path
1.25 +15 -0 xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java
Index: ClassRep.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ClassRep.java 27 Mar 2002 16:46:56 -0000 1.24
+++ ClassRep.java 28 Mar 2002 15:21:46 -0000 1.25
@@ -327,6 +327,21 @@
// move up the inhertance chain
currentClass = currentClass.getSuperclass();
}
+
+ // Mark all overloaded methods
+ HashMap map = new HashMap();
+ for (int i = 0; i < _methods.size(); ++i) {
+ MethodRep method = (MethodRep) _methods.get(i);
+ String methodName = method.getName();
+ MethodRep otherMethod = (MethodRep) map.get(methodName);
+ if (otherMethod != null) {
+ otherMethod.setOverloaded();
+ method.setOverloaded();
+ }
+ else {
+ map.put(methodName, method);
+ }
+ }
}
/**
1.26 +28 -8 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Emitter.java 26 Mar 2002 16:09:45 -0000 1.25
+++ Emitter.java 28 Mar 2002 15:21:47 -0000 1.26
@@ -570,8 +570,9 @@
for(int i=0; i<methods.size(); i++) {
MethodRep method = (MethodRep) methods.elementAt(i);
- Operation oper = writeOperation(def, binding, method);
- writeMessages(def, oper, method);
+ BindingOperation bindingOper = writeOperation(def, binding, method);
+ Operation oper = bindingOper.getOperation();
+ writeMessages(def, oper, method, bindingOper);
portType.addOperation(oper);
}
@@ -587,12 +588,21 @@
* @param method (A MethodRep object)
* @throws Exception
*/
- private void writeMessages(Definition def, Operation oper,
- MethodRep method) throws Exception{
+ private void writeMessages(Definition def, Operation oper,
+ MethodRep method, BindingOperation bindingOper)
+ throws Exception{
Input input = def.createInput();
Message msg = writeRequestMessage(def, method);
input.setMessage(msg);
+
+ // Iff this method is overloaded, then give the input
+ // stanzas a name.
+ if (method.isOverloaded()) {
+ String name = msg.getQName().getLocalPart();
+ input.setName(name);
+ bindingOper.getBindingInput().setName(name);
+ }
oper.setInput(input);
def.addMessage(msg);
@@ -600,6 +610,14 @@
msg = writeResponseMessage(def, method);
Output output = def.createOutput();
output.setMessage(msg);
+
+ // Iff this method is overloaded, then give the output
+ // stanzas a name.
+ if (method.isOverloaded()) {
+ String name = msg.getQName().getLocalPart();
+ output.setName(name);
+ bindingOper.getBindingOutput().setName(name);
+ }
oper.setOutput(output);
def.addMessage(msg);
@@ -639,14 +657,13 @@
* @param methodRep - Representation of the method
* @throws Exception
*/
- private Operation writeOperation(Definition def,
+ private BindingOperation writeOperation(Definition def,
Binding binding,
MethodRep methodRep) {
Operation oper = def.createOperation();
oper.setName(methodRep.getName());
oper.setUndefined(false);
- writeBindingOperation(def, binding, oper, methodRep);
- return oper;
+ return writeBindingOperation(def, binding, oper, methodRep);
}
/** Create a Binding Operation
@@ -657,7 +674,7 @@
* @param methodRep - Representation of the method
* @throws Exception
*/
- private void writeBindingOperation (Definition def,
+ private BindingOperation writeBindingOperation (Definition def,
Binding binding,
Operation oper,
MethodRep methodRep) {
@@ -666,6 +683,7 @@
BindingOutput bindingOutput = def.createBindingOutput();
bindingOper.setName(oper.getName());
+ bindingOper.setOperation(oper);
SOAPOperation soapOper = new SOAPOperationImpl();
String soapAction = methodRep.getMetaData("soapAction");
@@ -723,6 +741,8 @@
bindingOper.setBindingOutput(bindingOutput);
binding.addBindingOperation(bindingOper);
+
+ return bindingOper;
}
/** Create a Request Message
1.11 +4 -1 xml-axis/java/src/org/apache/axis/wsdl/fromJava/MethodRep.java
Index: MethodRep.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/MethodRep.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MethodRep.java 27 Mar 2002 16:46:56 -0000 1.10
+++ MethodRep.java 28 Mar 2002 15:21:47 -0000 1.11
@@ -72,7 +72,8 @@
public class MethodRep extends BaseRep {
private String _name = "";
- private ParamRep _returns = null;
+ private ParamRep _returns = null;
+ private boolean _overloaded = false;
private Vector _parameters = new Vector();
private Vector _exceptions = new Vector();
@@ -169,4 +170,6 @@
public void setParameters(Vector v) { _parameters = v; }
public Vector getExceptions() { return _exceptions; }
public void setExceptions(Vector v) { _exceptions = v; }
+ public void setOverloaded() { _overloaded = true; }
+ public boolean isOverloaded() { return _overloaded; }
};