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 du...@apache.org on 2005/06/03 06:32:16 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp BeanParamWriter.java

dushshantha    2005/06/02 21:32:16

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
                        BeanParamWriter.java
  Log:
  Fix to the issue AXISCPP-608
  
  Revision  Changes    Path
  1.43      +62 -13    ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
  
  Index: BeanParamWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- BeanParamWriter.java	18 May 2005 05:39:45 -0000	1.42
  +++ BeanParamWriter.java	3 Jun 2005 04:32:16 -0000	1.43
  @@ -543,7 +543,20 @@
               return;
           }
           String arrayType = null;
  -        
  +		
  +		/**
  +		  *to handle simple type arrays
  +		  */
  +		  
  +		for(int i = 0; i< attribs.length;i++)
  +		{
  +			
  +			if(attribs[i].isArray()) 
  +			{
  +				writer.write("\tAxis_Array array;\n\n");
  +				break;
  +			}
  +		}	
           
   		//Dushshantha:
   		//peekCalled boolean variable checks whether the Line 
  @@ -614,18 +627,54 @@
                       //if Array
                       if (attribs[i].isSimpleType())
                       {
  -                        writer.write(
  -                            "\tparam->"
  -                                + attribs[i].getParamNameAsMember()
  -                                + " = ("
  -                                + CUtils.getBasicArrayNameforType(
  -                                    attribs[i].getTypeName())
  -                                + "&)pIWSDZ->getBasicArray("
  -                                + CUtils.getXSDTypeForBasicType(
  -                                    attribs[i].getTypeName())
  -                                + ", \""
  -                                + attribs[i].getParamName()
  -                                + "\",0);\n");
  +						writer.write("\tarray = pIWSDZ->getBasicArray("+CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+ ", \""+attribs[i].getParamNameAsSOAPElement()+"\",0);\n");
  +						//					writer.write("\tparam->"+attribs[i].getParamNameAsMember()+" = ("+CUtils.getBasicArrayNameforType(attribs[i].getTypeName())+"&)array;\n");
  +						String typename = attribs[i].getTypeName();
  +						if (typename.equals("xsd__string")
  +							|| typename.equals("xsd__anyURI")
  +							|| typename.equals("xsd__QName")
  +							|| typename.equals("xsd__notation")
  +							|| typename.equals("xsd__NMTOKEN"))
  +						{
  +						
  +							if(attribs[i].getChoiceElement())			
  +								writer.write("\tparam->"+attribs[i].getParamNameAsMember()+"->m_Array = ("+attribs[i].getTypeName()+"*)new "+attribs[i].getTypeName()+"[array.m_Size];\n");
  +							else
  +								writer.write("\tparam->"+attribs[i].getParamNameAsMember()+".m_Array = ("+attribs[i].getTypeName()+"*)new "+attribs[i].getTypeName()+"[array.m_Size];\n");
  +						}
  +						else
  +						{
  +						
  +							/**
  +							 *Dushshantha:
  +							 *If the element is a Choice,
  +							 *It should be treated as a pointer to an array. 
  +							 *Chinthana: This is the same in 'all' element
  +							 */
  +						
  +							if(attribs[i].getChoiceElement() || attribs[i].getAllElement())
  +								writer.write("\tparam->"+attribs[i].getParamNameAsMember()+"->m_Array = ("+attribs[i].getTypeName()+"**)new "+attribs[i].getTypeName()+"*[array.m_Size];\n");
  +							else
  +								writer.write("\tparam->"+attribs[i].getParamNameAsMember()+".m_Array = ("+attribs[i].getTypeName()+"**)new "+attribs[i].getTypeName()+"*[array.m_Size];\n");
  +						}
  +					
  +						/**
  +						 *Dushshantha:
  +						 *If the element is a Choice,
  +						 *It should be treated as a pointer to an array. 
  +						 *Chinthana: This is the same in 'all' element
  +						 */
  +					
  +						if(attribs[i].getChoiceElement() || attribs[i].getAllElement())
  +						{
  +							writer.write("\tparam->"+attribs[i].getParamNameAsMember()+"->m_Size = array.m_Size;\n\n");
  +							writer.write("\tmemcpy( param->"+attribs[i].getParamNameAsMember()+"->m_Array, array.m_Array, sizeof( "+attribs[i].getTypeName()+" *) * array.m_Size);\n");
  +						}
  +						else
  +						{
  +							writer.write("\tparam->"+attribs[i].getParamNameAsMember()+".m_Size = array.m_Size;\n\n");
  +							writer.write("\tmemcpy( param->"+attribs[i].getParamNameAsMember()+".m_Array, array.m_Array, sizeof( "+attribs[i].getTypeName()+" *) * array.m_Size);\n");
  +						}
                       }
                       else
                       {