axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susan...@apache.org
Subject cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal ClientStubHeaderWriter.java ClientStubWriter.java
Date Thu, 19 Feb 2004 10:27:54 GMT
susantha    2004/02/19 02:27:54

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws WSDL2Ws.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c
                        ClientStubHeaderWriter.java ClientStubWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal
                        ClientStubHeaderWriter.java ClientStubWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
                        ClientStubHeaderWriter.java ClientStubWriter.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
                        ClientStubHeaderWriter.java ClientStubWriter.java
  Log:
  improvement of WSDL2Ws tool for client side code generation when there are multiple return
parameters in a web service method
  
  Revision  Changes    Path
  1.16      +4 -3      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
  
  Index: WSDL2Ws.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- WSDL2Ws.java	17 Feb 2004 12:47:44 -0000	1.15
  +++ WSDL2Ws.java	19 Feb 2004 10:27:53 -0000	1.16
  @@ -283,7 +283,7 @@
   	    	  	while (paramlist.hasNext()) {
   	        	 	Part p = (Part) paramlist.next();
   	            	pinfo = createParameterInfo(p);
  -	               	minfo.addInputParameter(pinfo);
  +					if (null != pinfo) minfo.addInputParameter(pinfo);
   	           	}
               }
               //get the return type
  @@ -327,9 +327,10 @@
   				}*/
   			}
   			else{
  -	            if (returnlist.hasNext()) {
  +	            while (returnlist.hasNext()) {
   	                Part p = ((Part) returnlist.next());
  -	   		        minfo.addOutputParameter(createParameterInfo(p));
  +					pinfo = createParameterInfo(p);
  +					if (null != pinfo) minfo.addOutputParameter(pinfo);
   	            }
   			}
           }
  
  
  
  1.8       +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubHeaderWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ClientStubHeaderWriter.java	10 Feb 2004 15:04:21 -0000	1.7
  +++ ClientStubHeaderWriter.java	19 Feb 2004 10:27:53 -0000	1.8
  @@ -154,7 +154,7 @@
   					params = minfo.getOutputParameterTypes().iterator();
   					for(int j =0; params.hasNext();j++){
   						ParameterInfo nparam = (ParameterInfo)params.next();
  -						writer.write(", AXIS_OUT_PARAM"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
  +						writer.write(", AXIS_OUT_PARAM "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
   					}
   			  	}
   			  	writer.write(");\n");
  
  
  
  1.12      +58 -4     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ClientStubWriter.java	10 Feb 2004 15:04:22 -0000	1.11
  +++ ClientStubWriter.java	19 Feb 2004 10:27:53 -0000	1.12
  @@ -156,8 +156,6 @@
   		}
   		else{
   			isAllTreatedAsOutParams = true;
  -			//TODO make all outparams when there are more than one return params
  -			throw new WrapperFault("WSDL2Ws does not still handle more than one return parameters");
   		}
   		Collection params = minfo.getInputParameterTypes();
   		String methodName = minfo.getMethodname();
  @@ -199,6 +197,18 @@
   				aretherearrayparams = true;
   			}
   		}
  +		// Multiples parameters so fill the methods prototype
  +		ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
  +		if ( isAllTreatedAsOutParams ) {
  +			String currentParaTypeName;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
  +				writer.write(", AXIS_OUT_PARAM  "+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+"
*OutValue"+i);
  +				if((type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName()))
!= null && type.isArray()){
  +					aretherearrayparams = true;
  +				}
  +			}
  +		}
   		writer.write(")\n{\n");
   		writer.write("\tCall* pCall = (Call*)pStub;\n");
   		if (returntype != null){
  @@ -215,7 +225,7 @@
   				//TODO initialize return parameter appropriately.
   			}
   		}
  -		if (aretherearrayparams){
  +		if (aretherearrayparams || returntypeisarray){
   			writer.write("\tAxis_Array array;\n");
   		}
   		writer.write("\t/* Following will establish the connections with the server too */\n");
  @@ -267,7 +277,51 @@
   		}
   		writer.write("\tif (AXIS_SUCCESS == pCall->_functions->Invoke(pCall->_object))\n\t{\n");
   		writer.write("\t\tif(AXIS_SUCCESS == pCall->_functions->CheckMessage(pCall->_object,
\""+methodName+"Response\", \"\"))\n\t\t{\n");
  -		if (returntype == null){
  +		if ( isAllTreatedAsOutParams) {
  +			String currentParamName;
  +			String currentParaType;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				ParameterInfo currentType = (ParameterInfo)paramsC.get(i);
  +				type = wscontext.getTypemap().getType(currentType.getSchemaName());
  +				if (type != null){
  +					currentParaType = type.getLanguageSpecificName();
  +					typeisarray = type.isArray();
  +				}
  +				else {
  +					currentParaType = ((ParameterInfo)paramsC.get(i)).getLangName();
  +					typeisarray = false;
  +				}
  +				typeissimple = CUtils.isSimpleType(currentParaType);
  +								
  +				currentParamName = "*OutValue"+i;
  +				// Some code need to be merged as we have some duplicated in coding here.
  +				if (typeisarray){
  +					QName qname = WrapperUtils.getArrayType(type).getName();
  +					String containedType = null;
  +					if (CUtils.isSimpleType(qname)){
  +						containedType = CUtils.getclass4qname(qname);
  +						writer.write("\t\t\tarray = pCall->_functions->GetBasicArray(pCall->_object,
"+CUtils.getXSDTypeForBasicType(containedType)+", \""+currentType.getParamName()+"\", 0);\n");
  +						writer.write("\t\t\tmemcpy(OutValue"+ i +", &array, sizeof(Axis_Array));\n");
  +
  +					}
  +					else{
  +						containedType = qname.getLocalPart();
  +						writer.write("\t\t\tarray = pCall->_functions->GetCmplxArray(pCall->_object,
(void*) Axis_DeSerialize_"+containedType);
  +						writer.write(", (void*) Axis_Create_"+containedType+", (void*) Axis_Delete_"+containedType+",
(void*) Axis_GetSize_"+containedType+", \""+currentType.getParamName()+"\", Axis_URI_"+containedType+");\n");
  +						writer.write("\t\t\tmemcpy(OutValue"+ i +", &array, sizeof(Axis_Array));\n");
  +					}
  +				}
  +				else if(typeissimple){
  +				   writer.write("\t\t\t" + currentParamName + " = pCall->_functions->"+ CUtils.getParameterGetValueMethodName(currentParaType,
false)+"(pCall->_object, \""+currentType.getParamName()+"\", 0);\n");
  +				}
  +				else{
  +				   writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"*)pCall->_functions->GetCmplxObject(pCall->_object,
(void*) Axis_DeSerialize_"+currentParaType+", (void*) Axis_Create_"+currentParaType+", (void*)
Axis_Delete_"+currentParaType+",\""+currentType.getParamName()+"\", 0);\n"); 
  +				}				
  +			}	
  +			writer.write("\t\t}\n");
  +			writer.write("\t}\n\tpCall->_functions->UnInitialize(pCall->_object);\n");
  +		}
  +		else if (returntype == null){
   			writer.write("\t\t\t/*not successful*/\n\t\t}\n");
   			writer.write("\t}\n\tpCall->_functions->UnInitialize(pCall->_object);\n");
   		}
  
  
  
  1.5       +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClientStubHeaderWriter.java	10 Feb 2004 15:04:22 -0000	1.4
  +++ ClientStubHeaderWriter.java	19 Feb 2004 10:27:53 -0000	1.5
  @@ -152,7 +152,7 @@
   					params = minfo.getOutputParameterTypes().iterator();
   					for(int j =0; params.hasNext();j++){
   						ParameterInfo nparam = (ParameterInfo)params.next();
  -						writer.write(", AXIS_OUT_PARAM"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
  +						writer.write(", AXIS_OUT_PARAM "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
   					}
   			  	}
   			  	writer.write(");\n");
  
  
  
  1.11      +69 -41    ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ClientStubWriter.java	13 Feb 2004 07:00:29 -0000	1.10
  +++ ClientStubWriter.java	19 Feb 2004 10:27:53 -0000	1.11
  @@ -158,14 +158,13 @@
   		}
   		else{
   			isAllTreatedAsOutParams = true;
  -			//TODO make all outparams when there are more than one return params
  -			throw new WrapperFault("WSDL2Ws does not still handle more than one return parameters");
   		}
   		Collection params = minfo.getInputParameterTypes();
   		String methodName = minfo.getMethodname();
   		Type retType = null;
   		boolean returntypeissimple = false;
   		boolean returntypeisarray = false;
  +		boolean aretherearrayparams = false;
   		String outparamType = null;
   		if (returntype != null)
   			retType = wscontext.getTypemap().getType(returntype.getSchemaName());
  @@ -182,7 +181,7 @@
   		writer.write(" * This method wrap the service method"+ methodName +"\n");
   		writer.write(" */\n");
   		//method signature
  -		String paraTypeName;
  +		String paramTypeName;
   		boolean typeisarray = false;
   		boolean typeissimple = false;
   		Type type;
  @@ -196,43 +195,28 @@
   		}
   		writer.write(" "+ methodName + "(void* pStub");
   		ArrayList paramsB = (ArrayList)params;
  -		if (0 < paramsB.size()){
  -			type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(0)).getSchemaName());
  -			if (type != null){
  -				paraTypeName = type.getLanguageSpecificName();
  -				typeisarray = type.isArray();
  -			}
  -			else {
  -				paraTypeName = ((ParameterInfo)paramsB.get(0)).getLangName();
  -				typeisarray = false;
  -			}
  -			typeissimple = CUtils.isSimpleType(paraTypeName);
  -			if(typeisarray || typeissimple){
  -				writer.write(", "+paraTypeName+" Value0");
  -			}else{
  -				writer.write(", "+paraTypeName+"* Value0");
  +		for (int i = 0; i < paramsB.size(); i++) {
  +			paramTypeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsB.get(i),
wscontext);
  +			writer.write(", "+paramTypeName+" Value"+i);
  +			if((type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName()))
!= null && type.isArray()){
  +				aretherearrayparams = true;
   			}
  -			for (int i = 1; i < paramsB.size(); i++) {
  -				type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
  -				if (type != null){
  -					paraTypeName = type.getLanguageSpecificName();
  -					typeisarray = type.isArray();
  -				}
  -				else {
  -					paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
  -					typeisarray = false;
  -				}
  -				typeissimple = CUtils.isSimpleType(paraTypeName);
  -				if(typeisarray || typeissimple){
  -					writer.write(", "+paraTypeName+" Value"+i);
  -				}else{
  -					writer.write(", "+paraTypeName+"* Value"+i);
  +		}
  +		// Multiples parameters so fill the methods prototype
  +		ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
  +		if ( isAllTreatedAsOutParams ) {
  +			String currentParaTypeName;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
  +				writer.write(", AXIS_OUT_PARAM  "+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+"
*OutValue"+i);
  +				if((type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName()))
!= null && type.isArray()){
  +					aretherearrayparams = true;
   				}
   			}
   		}
   		writer.write(")\n{\n");
  -		if(returntypeisarray){
  -			writer.write("\tAxis_Array array;\n");				
  +		if (aretherearrayparams || returntypeisarray){
  +			writer.write("\tAxis_Array array;\n");
   		}
   		writer.write("\tCall* pCall = (Call*)pStub;\n");
   		if (returntype != null){
  @@ -263,14 +247,14 @@
   		for (int i = 0; i < paramsB.size(); i++) {
   			type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
   			if (type != null){
  -				paraTypeName = type.getLanguageSpecificName();
  +				paramTypeName = type.getLanguageSpecificName();
   				typeisarray = type.isArray();
   			}
   			else {
  -				paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
  +				paramTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
   				typeisarray = false;
   			}
  -			typeissimple = CUtils.isSimpleType(paraTypeName);
  +			typeissimple = CUtils.isSimpleType(paramTypeName);
   			if(typeisarray){
   				//arrays
   				QName qname = WrapperUtils.getArrayType(type).getName();
  @@ -288,17 +272,61 @@
   			}else if(typeissimple){
   				//for simple types	
   				writer.write("\tpCall->_functions->AddParameter(pCall->_object, ");			
  -				writer.write("(void*)&Value"+i+", \"" + ((ParameterInfo)paramsB.get(i)).getParamName()+"\",
"+CUtils.getXSDTypeForBasicType(paraTypeName));
  +				writer.write("(void*)&Value"+i+", \"" + ((ParameterInfo)paramsB.get(i)).getParamName()+"\",
"+CUtils.getXSDTypeForBasicType(paramTypeName));
   			}else{
   				//for complex types 
   				writer.write("\tpCall->_functions->AddCmplxParameter(pCall->_object, ");	
	
  -				writer.write("Value"+i+", (void*)Axis_Serialize_"+paraTypeName+", (void*)Axis_Delete_"+paraTypeName+",
\"" + ((ParameterInfo)paramsB.get(i)).getParamName()+"\", Axis_URI_"+paraTypeName);
  +				writer.write("Value"+i+", (void*)Axis_Serialize_"+paramTypeName+", (void*)Axis_Delete_"+paramTypeName+",
\"" + ((ParameterInfo)paramsB.get(i)).getParamName()+"\", Axis_URI_"+paramTypeName);
   			}
   			writer.write(");\n");
   		}
   		writer.write("\tif (AXIS_SUCCESS == pCall->_functions->Invoke(pCall->_object))\n\t{\n");
   		writer.write("\t\tif(AXIS_SUCCESS == pCall->_functions->CheckMessage(pCall->_object,
\""+minfo.getOutputMessage().getLocalPart()+"\", \""+minfo.getOutputMessage().getNamespaceURI()+"\"))\n\t\t{\n");
  -		if (returntype == null){
  +		if ( isAllTreatedAsOutParams) {
  +			String currentParamName;
  +			String currentParaType;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				ParameterInfo currentType = (ParameterInfo)paramsC.get(i);
  +				type = wscontext.getTypemap().getType(currentType.getSchemaName());
  +				if (type != null){
  +					currentParaType = type.getLanguageSpecificName();
  +					typeisarray = type.isArray();
  +				}
  +				else {
  +					currentParaType = ((ParameterInfo)paramsC.get(i)).getLangName();
  +					typeisarray = false;
  +				}
  +				typeissimple = CUtils.isSimpleType(currentParaType);
  +								
  +				currentParamName = "*OutValue"+i;
  +				// Some code need to be merged as we have some duplicated in coding here.
  +				if (typeisarray){
  +					QName qname = WrapperUtils.getArrayType(type).getName();
  +					String containedType = null;
  +					if (CUtils.isSimpleType(qname)){
  +						containedType = CUtils.getclass4qname(qname);
  +						writer.write("\t\t\tarray = pCall->_functions->GetBasicArray(pCall->_object,
"+CUtils.getXSDTypeForBasicType(containedType)+", \""+currentType.getElementName().getLocalPart()+"\",
0);\n");
  +						writer.write("\t\t\tmemcpy(OutValue"+ i +", &array, sizeof(Axis_Array));\n");
  +
  +					}
  +					else{
  +						containedType = qname.getLocalPart();
  +						writer.write("\t\t\tarray = pCall->_functions->GetCmplxArray(pCall->_object,
(void*) Axis_DeSerialize_"+containedType);
  +						writer.write(", (void*) Axis_Create_"+containedType+", (void*) Axis_Delete_"+containedType+",
(void*) Axis_GetSize_"+containedType+", \""+currentType.getElementName().getLocalPart()+"\",
Axis_URI_"+containedType+");\n");
  +						writer.write("\t\t\tmemcpy(OutValue"+ i +", &array, sizeof(Axis_Array));\n");
  +					}
  +				}
  +				else if(typeissimple){
  +				   writer.write("\t\t\t" + currentParamName + " = pCall->_functions->"+ CUtils.getParameterGetValueMethodName(currentParaType,
false)+"(pCall->_object, \""+currentType.getElementName().getLocalPart()+"\", 0);\n");
  +				}
  +				else{
  +				   writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"*)pCall->_functions->GetCmplxObject(pCall->_object,
(void*) Axis_DeSerialize_"+currentParaType+", (void*) Axis_Create_"+currentParaType+", (void*)
Axis_Delete_"+currentParaType+",\""+currentType.getElementName().getLocalPart()+"\", 0);\n");

  +				}				
  +			}	
  +			writer.write("\t\t}\n");
  +			writer.write("\t}\n\tpCall->_functions->UnInitialize(pCall->_object);\n");
  +		}
  +		else if (returntype == null){
   			writer.write("\t\t\t/*not successful*/\n\t\t}\n");
   			writer.write("\t}\n\tpCall->_functions->UnInitialize(pCall->_object);\n");
   		}
  
  
  
  1.9       +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ClientStubHeaderWriter.java	20 Jan 2004 14:05:18 -0000	1.8
  +++ ClientStubHeaderWriter.java	19 Feb 2004 10:27:54 -0000	1.9
  @@ -180,7 +180,7 @@
   				  params = minfo.getOutputParameterTypes().iterator();
   				  for(int j =0; params.hasNext();j++){
   					  ParameterInfo nparam = (ParameterInfo)params.next();
  -					  writer.write(", AXIS_OUT_PARAM"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
  +					  writer.write(", AXIS_OUT_PARAM "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
   				  }
   			  }			  
   			  writer.write(");\n");
  
  
  
  1.24      +52 -3     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ClientStubWriter.java	17 Feb 2004 12:47:44 -0000	1.23
  +++ ClientStubWriter.java	19 Feb 2004 10:27:54 -0000	1.24
  @@ -181,8 +181,6 @@
   		}
   		else{
   			isAllTreatedAsOutParams = true;
  -			//TODO make all outparams when there are more than one return params
  -			throw new WrapperFault("WSDL2Ws does not still handle more than one return parameters");
   		}
   		Collection params = minfo.getInputParameterTypes();
   		String methodName = minfo.getMethodname();
  @@ -253,6 +251,16 @@
   				}
   			}
   		}
  +		// Multiples parameters so fill the methods prototype
  +		ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
  +		if ( isAllTreatedAsOutParams ) {
  +			String currentParaTypeName;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
  +				writer.write(", AXIS_OUT_PARAM  "+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+"
*OutValue"+i);
  +			}
  +		}
  +
   		writer.write(")\n{\n");
   		if (returntype != null){
   			writer.write("\t");
  @@ -316,7 +324,48 @@
   		}
   		writer.write("\tif (AXIS_SUCCESS == m_pCall->Invoke())\n\t{\n");
   		writer.write("\t\tif(AXIS_SUCCESS == m_pCall->CheckMessage(\""+minfo.getMethodname()+"Response\",
\"\"))\n\t\t{\n");
  -		if (returntype == null){
  +		if ( isAllTreatedAsOutParams) {
  +			String currentParamName;
  +			String currentParaType;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				ParameterInfo currentType = (ParameterInfo)paramsC.get(i);
  +				type = wscontext.getTypemap().getType(currentType.getSchemaName());
  +				if (type != null){
  +					currentParaType = type.getLanguageSpecificName();
  +					typeisarray = type.isArray();
  +				}
  +				else {
  +					currentParaType = ((ParameterInfo)paramsC.get(i)).getLangName();
  +					typeisarray = false;
  +				}
  +				typeissimple = CUtils.isSimpleType(currentParaType);
  +								
  +				currentParamName = "*OutValue"+i;
  +				// Some code need to be merged as we have some duplicated in coding here.
  +				if (typeisarray){
  +					QName qname = WrapperUtils.getArrayType(type).getName();
  +					String containedType = null;
  +					if (CUtils.isSimpleType(qname)){
  +						containedType = CUtils.getclass4qname(qname);
  +						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+",
\""+currentType.getParamName()+"\", 0);\n");
  +					}
  +					else{
  +						containedType = qname.getLocalPart();
  +						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetCmplxArray((void*)
Axis_DeSerialize_"+containedType);
  +						writer.write(", (void*) Axis_Create_"+containedType+", (void*) Axis_Delete_"+containedType+",
(void*) Axis_GetSize_"+containedType+", \""+currentType.getParamName()+"\", Axis_URI_"+containedType+");\n");
  +					}
  +				}
  +				else if(typeissimple){
  +				   writer.write("\t\t\t" + currentParamName + " = m_pCall->"+ CUtils.getParameterGetValueMethodName(currentParaType,
false)+"(\""+currentType.getParamName()+"\", 0);\n");
  +				}
  +				else{
  +				   writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"*)m_pCall->GetCmplxObject((void*)
Axis_DeSerialize_"+currentParaType+", (void*) Axis_Create_"+currentParaType+", (void*) Axis_Delete_"+currentParaType+",\""+currentType.getParamName()+"\",
0);\n"); 
  +				}				
  +			}	
  +			writer.write("\t\t}\n");
  +			writer.write("\t}\n\tm_pCall->UnInitialize();\n");	
  +		}
  +		else if (returntype == null){
   			writer.write("\t\t\t/*not successful*/\n\t\t}\n");
			writer.write("\t}\n\tm_pCall->UnInitialize();\n");
   		}
   		else if (returntypeisarray){
  
  
  
  1.6       +1 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
  
  Index: ClientStubHeaderWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ClientStubHeaderWriter.java	20 Jan 2004 14:05:18 -0000	1.5
  +++ ClientStubHeaderWriter.java	19 Feb 2004 10:27:54 -0000	1.6
  @@ -180,7 +180,7 @@
   				  params = minfo.getOutputParameterTypes().iterator();
   				  for(int j =0; params.hasNext();j++){
   					  ParameterInfo nparam = (ParameterInfo)params.next();
  -					  writer.write(", AXIS_OUT_PARAM"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
  +					  writer.write(", AXIS_OUT_PARAM "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+"
*OutValue"+j);
   				  }
   			  }			  
   			  writer.write(");\n");
  
  
  
  1.8       +56 -4     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
  
  Index: ClientStubWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ClientStubWriter.java	13 Feb 2004 07:00:30 -0000	1.7
  +++ ClientStubWriter.java	19 Feb 2004 10:27:54 -0000	1.8
  @@ -181,8 +181,6 @@
   		}
   		else{
   			isAllTreatedAsOutParams = true;
  -			//TODO make all outparams when there are more than one return params
  -			throw new WrapperFault("WSDL2Ws does not still handle more than one return parameters");
   		}
   		Collection params = minfo.getInputParameterTypes();
   		String methodName = minfo.getMethodname();
  @@ -253,6 +251,17 @@
   				}
   			}
   		}
  +		
  +		// Multiples parameters so fill the methods prototype
  +		ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
  +		if ( isAllTreatedAsOutParams ) {
  +			String currentParaTypeName;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
  +				writer.write(", AXIS_OUT_PARAM  "+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+"
*OutValue"+i);
  +			}
  +		}
  +		
   		writer.write(")\n{\n");
   		if (returntype != null){
   			writer.write("\t");
  @@ -316,8 +325,50 @@
   		}
   		writer.write("\tif (AXIS_SUCCESS == m_pCall->Invoke())\n\t{\n");
   		writer.write("\t\tif(AXIS_SUCCESS == m_pCall->CheckMessage(\""+minfo.getOutputMessage().getLocalPart()+"\",
\""+minfo.getOutputMessage().getNamespaceURI()+"\"))\n\t\t{\n");
  -		if (returntype == null){
  -			writer.write("\t\t\t/*not successful*/\n\t\t}\n");
			writer.write("\t}\n\tm_pCall->UnInitialize();\n");
  +		if ( isAllTreatedAsOutParams) {
  +			String currentParamName;
  +			String currentParaType;
  +			for (int i = 0; i < paramsC.size(); i++) {
  +				ParameterInfo currentType = (ParameterInfo)paramsC.get(i);
  +				type = wscontext.getTypemap().getType(currentType.getSchemaName());
  +				if (type != null){
  +					currentParaType = type.getLanguageSpecificName();
  +					typeisarray = type.isArray();
  +				}
  +				else {
  +					currentParaType = ((ParameterInfo)paramsC.get(i)).getLangName();
  +					typeisarray = false;
  +				}
  +				typeissimple = CUtils.isSimpleType(currentParaType);
  +								
  +				currentParamName = "*OutValue"+i;
  +				// Some code need to be merged as we have some duplicated in coding here.
  +				if (typeisarray){
  +					QName qname = WrapperUtils.getArrayType(type).getName();
  +					String containedType = null;
  +					if (CUtils.isSimpleType(qname)){
  +						containedType = CUtils.getclass4qname(qname);
  +						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+",
\""+currentType.getElementName().getLocalPart()+"\", 0);\n");
  +					}
  +					else{
  +						containedType = qname.getLocalPart();
  +						writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"&)m_pCall->GetCmplxArray((void*)
Axis_DeSerialize_"+containedType);
  +						writer.write(", (void*) Axis_Create_"+containedType+", (void*) Axis_Delete_"+containedType+",
(void*) Axis_GetSize_"+containedType+", \""+currentType.getElementName().getLocalPart()+"\",
Axis_URI_"+containedType+");\n");
  +					}
  +				}
  +				else if(typeissimple){
  +				   writer.write("\t\t\t" + currentParamName + " = m_pCall->"+ CUtils.getParameterGetValueMethodName(currentParaType,
false)+"(\""+currentType.getElementName().getLocalPart()+"\", 0);\n");
  +				}
  +				else{
  +				   writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"*)m_pCall->GetCmplxObject((void*)
Axis_DeSerialize_"+currentParaType+", (void*) Axis_Create_"+currentParaType+", (void*) Axis_Delete_"+currentParaType+",\""+currentType.getElementName().getLocalPart()+"\",
0);\n"); 
  +				}				
  +			}	
  +			writer.write("\t\t}\n");
  +			writer.write("\t}\n\tm_pCall->UnInitialize();\n");	
  +		}
  +		else if (returntype == null){
  +			writer.write("\t\t\t/*not successful*/\n\t\t}\n");
  +			writer.write("\t}\n\tm_pCall->UnInitialize();\n");
   		}
   		else if (returntypeisarray){
   			QName qname = WrapperUtils.getArrayType(retType).getName();
  @@ -347,6 +398,7 @@
   		//write end of method
   		writer.write("}\n");
   	}
  +	 
   	/* (non-Javadoc)
   	 * @see org.apache.axis.wsdl.wsdl2ws.cpp.CPPClassWriter#writeGlobalCodes()
   	 */
  
  
  

Mime
View raw message