Package org.apache.axis.wsdl.wsdl2ws.info

Examples of org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo


        int noOfOutParams = minfo.getOutputParameterTypes().size();
        //write return type
        if(0==noOfOutParams)
          writer.write("\tvoid ");
        else if(1==noOfOutParams){
          ParameterInfo returnParam = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
          String outparam = returnParam.getLangName();
          writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(returnParam,wscontext)+" ");
        }
        else{
          isAllTreatedAsOutParams = true;
          writer.write("\tvoid ");
        }
        //write return type
        writer.write(minfo.getMethodname()+"(");
           
        //write parameter names
        Iterator params = minfo.getInputParameterTypes().iterator();
        if(params.hasNext()){
            ParameterInfo fparam = (ParameterInfo)params.next();
          writer.write(WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext)+" Value"+0);
        }
        for(int j =1; params.hasNext();j++){
          ParameterInfo nparam = (ParameterInfo)params.next();
          writer.write(","+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+" Value"+j);
        }
        if (isAllTreatedAsOutParams){
          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(");\n");
      }
View Full Code Here


          {
               FaultInfo info = (FaultInfo)paramsFault.next();     
             ArrayList paramInfo =info.getParams();
             for (int j= 0; j < paramInfo.size(); j++)
             {
                 ParameterInfo par =(ParameterInfo)paramInfo.get(j);                                                                                                                                                          
               paramName  = par.getParamName();
               langName =par.getLangName();                
               writer.write("#include \""+langName+".h\"\n\n");                          
              }
            }
           }     
        }
View Full Code Here

      writer.write("\t\tvoid init();\n");
      writer.write("\t\tvoid fini();\n");
        for(int i = 0; i < methods.size(); i++){
          minfo = (MethodInfo)this.methods.get(i);
        boolean isAllTreatedAsOutParams = false;
        ParameterInfo returntype = null;
        int noOfOutParams = minfo.getOutputParameterTypes().size();
        if (0==noOfOutParams){
          returntype = null;
          writer.write("\t\tvoid ");
        }
        else if (1==noOfOutParams){
          returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
          String outparam = returntype.getLangName();
          writer.write("\t\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(returntype,wscontext)+" ");
        }
        else{
          isAllTreatedAsOutParams = true;
          writer.write("\t\tvoid ");
        }
          //write return type
          writer.write(minfo.getMethodname()+"(");
          //write parameter names
          Iterator params = minfo.getInputParameterTypes().iterator();
          if(params.hasNext()){
              ParameterInfo fparam = (ParameterInfo)params.next();
            writer.write(WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext)+" Value"+0);
          }
          for(int j =1; params.hasNext();j++){
            ParameterInfo nparam = (ParameterInfo)params.next();
            writer.write(","+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+" Value"+j);
          }
        if (isAllTreatedAsOutParams){
          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(");\n");
        }
View Full Code Here

   */

  public void writeMethodInWrapper(MethodInfo minfo) throws WrapperFault,IOException {
    Type type;
    boolean isAllTreatedAsOutParams = false;
    ParameterInfo returntype = null;
    int noOfOutParams = minfo.getOutputParameterTypes().size();
    if (0==noOfOutParams){
      returntype = null;
    }
    else if (1==noOfOutParams){
      returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
    }
    else{
      isAllTreatedAsOutParams = true;
    }
    Collection params = minfo.getInputParameterTypes();
    String methodName = minfo.getMethodname();
    Type retType = null;
    String outparamType = null;   
    String outparamTypeName = null;
    boolean returntypeissimple = false;
    boolean returntypeisarray = false;
    if (returntype != null){
      outparamTypeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(returntype, wscontext);
      retType = wscontext.getTypemap().getType(returntype.getSchemaName());
      if (retType != null){
        returntypeisarray = retType.isArray();
        if (CUtils.isSimpleType(retType.getLanguageSpecificName())){
          returntypeissimple = true;
        }
      }
    }
    writer.write("\n/*\n");
    writer.write(" * This method wrap the service method \n");
    writer.write(" */\n");
    //method signature
    writer.write("int "+classname+"::" + methodName + "(void* pMsg)\n{\n");
    writer.write("\tIMessageData* mc = (IMessageData*)pMsg;\n");
    writer.write("\tint nStatus;\n");
    writer.write("\tIWrapperSoapSerializer* pIWSSZ = NULL;\n");
    writer.write("\tmc->getSoapSerializer(&pIWSSZ);\n");
    writer.write("\tif (!pIWSSZ) return AXIS_FAIL;\n");
    writer.write("\tIWrapperSoapDeSerializer* pIWSDZ = NULL;\n");
    writer.write("\tmc->getSoapDeSerializer(&pIWSDZ);\n");
    writer.write("\tif (!pIWSDZ) return AXIS_FAIL;\n");
    writer.write("\t/* check whether we have got correct message */\n");
    writer.write("\tif (AXIS_SUCCESS != pIWSDZ->checkMessageBody(\""+minfo.getMethodname()+"\", \""+wscontext.getWrapInfo().getTargetNameSpaceOfWSDL()+"\")) return AXIS_FAIL;\n");
    writer.write("\tpIWSSZ->createSoapMethod(\""+minfo.getMethodname()+"Response\", \""+wscontext.getWrapInfo().getTargetNameSpaceOfWSDL()+"\");\n");
    //create and populate variables for each parameter
    String paraTypeName;
    String parameterName;
    String returnParamName;
    String paramType;
    ArrayList paramsB = new ArrayList(params);
    for (int i = 0; i < paramsB.size(); i++) {
      paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
      paramType = WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsB.get(i), wscontext);
      parameterName = ((ParameterInfo)paramsB.get(i)).getParamName();
      if((CUtils.isSimpleType(((ParameterInfo)paramsB.get(i)).getLangName()))){
        //for simple types 
        writer.write("\t"+paraTypeName+" v"+i+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(paraTypeName, false)+"(\""+parameterName+"\",0);\n");
      }else if((type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName())) != null && type.isArray()){
        QName qname = WrapperUtils.getArrayType(type).getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\t"+paramType+" v"+i+" = ("+CUtils.getBasicArrayNameforType(containedType)+"&)pIWSDZ->getBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+ ", \""+parameterName+"\",0);\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\t"+paramType+" v"+i+" = ("+paramType+"&)pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_"+containedType+
            "\n\t\t, (void*)Axis_Create_"+containedType+", (void*)Axis_Delete_"+containedType+
            "\n\t\t, (void*)Axis_GetSize_"+containedType+", \""+parameterName+"\", Axis_URI_"+containedType+");\n");
        }
      }else{
        //for complex types
        writer.write("\t"+paraTypeName+" *v"+i+" = ("+paraTypeName+"*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_"+paraTypeName+
          "\n\t\t, (void*)Axis_Create_"+paraTypeName+", (void*)Axis_Delete_"+paraTypeName+
          "\n\t\t, \""+parameterName+"\", Axis_URI_"+paraTypeName+");\n");       
      }
    }
    writer.write("\tif (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus())) return nStatus;\n");     
    // Multiples parameters so fill the methods prototype
    if ( isAllTreatedAsOutParams ) {
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
        writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+" out"+i+";\n");
      }
    }
                writer.write("\ttry\n\t{\n");
    if(returntype != null){       
      /* Invoke the service when return type not void */
      writer.write("\t\t"+outparamTypeName+" ret = "+"pWs->"+methodName+"(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size() - 1; i++) {
          writer.write("v" + i + ",");
        }
        writer.write("v" + ( paramsB.size() - 1));
      }
      writer.write(");\n");
      /* set the result */
      if (returntypeissimple){
        writer.write("\t\treturn pIWSSZ->addOutputParam(\""+methodName+"Return\", (void*)&ret, "+CUtils.getXSDTypeForBasicType(outparamTypeName)+");\n");
      }else if(returntypeisarray){
        QName qname = WrapperUtils.getArrayType(retType).getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\t\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+methodName+"Return\");\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\t\treturn pIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&ret),"+
          "(void*) Axis_Serialize_"+containedType+", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+methodName+"Return\", Axis_URI_"+containedType+");\n");
        }
      }
      else{
        //complex type
        outparamTypeName = returntype.getLangName();//need to have complex type name without *
        writer.write("\t\treturn pIWSSZ->addOutputCmplxParam(ret, (void*)Axis_Serialize_"+outparamTypeName+", (void*)Axis_Delete_"+outparamTypeName+", \""+methodName+"Return\", Axis_URI_"+outparamTypeName+");\n");
      }
    }else if (isAllTreatedAsOutParams){
      writer.write("\t\tpWs->" + methodName + "(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size(); i++) {
          writer.write("v" + i + ",");
        }
      }
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size()-1; i++) {
        writer.write("&out" + i+",");
      }
      writer.write("&out" + (paramsC.size()-1));

      writer.write(");\n");
      paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        retType = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
        if (retType != null){
          outparamType = retType.getLanguageSpecificName();
          returntypeisarray = retType.isArray();
        }
        else{
          outparamType = returntype.getLangName();
        }
        returntypeissimple = CUtils.isSimpleType(outparamType);
        returnParamName = ((ParameterInfo)paramsC.get(i)).getParamName();
        if (returntypeissimple){
          writer.write("\t\tpIWSSZ->addOutputParam(\""+returnParamName+"\", (void*)&out"+i+", "+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
        }else if(returntypeisarray){
          QName qname = WrapperUtils.getArrayType(retType).getName();
          String containedType = null;
          if (CUtils.isSimpleType(qname)){
            containedType = CUtils.getclass4qname(qname);
            writer.write("\t\tpIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&out"+i+"),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
          }
          else{
            containedType = qname.getLocalPart();
            writer.write("\t\tpIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&out"+i+"),"+
            "(void*) Axis_Serialize_"+containedType+", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+returnParamName+"\", Axis_URI_"+containedType+");\n");
          }
        }
        else{
          //complex type
          writer.write("\t\tpIWSSZ->addOutputCmplxParam(out"+i+", (void*)Axis_Serialize_"+outparamType+", (void*)Axis_Delete_"+outparamType+", \""+returnParamName+"\", Axis_URI_"+outparamType+");\n");
        }
      }     
      writer.write("\treturn AXIS_SUCCESS;\n");
    }else{//method does not return anything
      /* Invoke the service when return type is void */
       writer.write("\t\tpWs->" + methodName + "(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size() - 1; i++) {
          writer.write("v" + i + ",");
        }
        writer.write("v" + ( paramsB.size() - 1));
      }
      writer.write(");\n");
      writer.write("\treturn AXIS_SUCCESS;\n");
     
    }   
             writer.write("\t}\n");//nithya         
                Iterator paramsFault = minfo.getFaultType().iterator();
                String faultInfoName =null;
                String faultType =null;
                String langName =null;
                String paramName =null;
                while (paramsFault.hasNext()){
                        FaultInfo info = (FaultInfo)paramsFault.next();
                        faultInfoName =info.getFaultInfo();
                        ArrayList paramInfo =info.getParams();
                        for (int i= 0; i < paramInfo.size(); i++) {
                                ParameterInfo par =(ParameterInfo)paramInfo.get(i);
                                paramName  = par.getParamName();
                                langName =par.getLangName();
                                faultType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(par,wscontext);                              
                                writeExceptions(faultType,faultInfoName,paramName,langName);
                        }
                 }
    writer.write("\tcatch(...){\n"); //nithya
View Full Code Here

   */

  public void writeMethodInWrapper(MethodInfo minfo) throws WrapperFault,IOException {
    Type type;
    boolean isAllTreatedAsOutParams = false;
    ParameterInfo returntype = null;
    int noOfOutParams = minfo.getOutputParameterTypes().size();
    if (0==noOfOutParams){
      returntype = null;
    }
    else if (1==noOfOutParams){
      returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
    }
    else{
      isAllTreatedAsOutParams = true;
    }
    Collection params = minfo.getInputParameterTypes();
    String methodName = minfo.getMethodname();
    Type retType = null;
    String outparamType = null;
    boolean returntypeissimple = false;
    boolean returntypeisarray = false;
    if (returntype != null){
      retType = wscontext.getTypemap().getType(returntype.getSchemaName());
      if (retType != null){
        if (retType.isSimpleType()){ //schema defined simpleType possibly with restrictions
          returntypeissimple = true;
          outparamType = CUtils.getclass4qname(retType.getBaseType());
        }
        else{
          outparamType = retType.getLanguageSpecificName();
          returntypeisarray = retType.isArray();
          returntypeissimple = CUtils.isSimpleType(outparamType);
        }
      }
      else{
        outparamType = returntype.getLangName();
        returntypeissimple = CUtils.isSimpleType(outparamType);
      }
    }
    writer.write("\n/*\n");
    writer.write(" * This method wrap the service method \n");
    writer.write(" */\n");
    //method signature
    writer.write("int "+classname+"::" + methodName + "(void* pMsg)\n{\n");
    writer.write("\tIMessageData* mc = (IMessageData*)pMsg;\n");
    writer.write("\tint nStatus;\n");
    writer.write("\tIWrapperSoapSerializer* pIWSSZ = NULL;\n");
    writer.write("\tmc->getSoapSerializer(&pIWSSZ);\n");
    writer.write("\tif (!pIWSSZ) return AXIS_FAIL;\n");
    writer.write("\tIWrapperSoapDeSerializer* pIWSDZ = NULL;\n");
    writer.write("\tmc->getSoapDeSerializer(&pIWSDZ);\n");
    writer.write("\tif (!pIWSDZ) return AXIS_FAIL;\n");
    writer.write("\t/* check whether we have got correct message */\n");
    writer.write("\tif (AXIS_SUCCESS != pIWSDZ->checkMessageBody(\""+minfo.getInputMessage().getLocalPart()+"\", \""+minfo.getInputMessage().getNamespaceURI()+"\")) return AXIS_FAIL;\n");
    if(minfo.getOutputMessage()!=null)
      writer.write("\tpIWSSZ->createSoapMethod(\""+minfo.getOutputMessage().getLocalPart()+"\", \""+minfo.getOutputMessage().getNamespaceURI()+"\");\n");
    //create and populate variables for each parameter
    String paraTypeName;
    String parameterName;
    String elementName;
    String returnParamName;
    ArrayList paramsB = new ArrayList(params);
    for (int i = 0; i < paramsB.size(); i++) {
      ParameterInfo param = (ParameterInfo)paramsB.get(i);
      type = this.wscontext.getTypemap().getType(param.getSchemaName());
      if (type != null && type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        paraTypeName = CUtils.getclass4qname(type.getBaseType());;
      }
      else{
        paraTypeName = param.getLangName();
      }
      parameterName = param.getParamName();
      elementName = param.getElementName().getLocalPart();
      if (type != null && type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        writer.write("\t"+paraTypeName+" v"+i+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(paraTypeName, false)+"(\""+elementName+"\",0);\n");
      }
      else if((CUtils.isSimpleType(param.getLangName()))){
        //for simple types 
        writer.write("\t"+paraTypeName+" v"+i+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(paraTypeName, false)+"(\""+elementName+"\",0);\n");
      }else if((type != null) && type.isArray()){
        Type arrayType = WrapperUtils.getArrayType(type);
        QName qname = arrayType.getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\t"+paraTypeName+" v"+i+" = ("+CUtils.getBasicArrayNameforType(containedType)+"&)pIWSDZ->getBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+ ", \""+elementName+"\",0);\n");
        }
        else if (arrayType.isSimpleType()){//SimpleType in the schema
          containedType = CUtils.getclass4qname(arrayType.getBaseType());
          writer.write("\t"+paraTypeName+" v"+i+" = ("+CUtils.getBasicArrayNameforType(containedType)+"&)pIWSDZ->getBasicArray("+CUtils.getXSDTypeForBasicType(containedType)+ ", \""+elementName+"\",0);\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\t"+paraTypeName+" v"+i+" = ("+paraTypeName+"&)pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_"+containedType+
            "\n\t\t, (void*)Axis_Create_"+containedType+", (void*)Axis_Delete_"+containedType+
            "\n\t\t, (void*)Axis_GetSize_"+containedType+", \""+elementName+"\", Axis_URI_"+containedType+");\n");
        }
      }else if (param.isAnyType()){
        //for anyType
        writer.write("\t"+paraTypeName+" *v"+i+" = ("+paraTypeName+"*)pIWSDZ->getAnyObject();\n");       
      }else{
        //for complex types
        writer.write("\t"+paraTypeName+" *v"+i+" = ("+paraTypeName+"*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_"+paraTypeName+
          "\n\t\t, (void*)Axis_Create_"+paraTypeName+", (void*)Axis_Delete_"+paraTypeName+
          "\n\t\t, \""+elementName+"\", Axis_URI_"+paraTypeName+");\n");       
      }
    }
    writer.write("\tif (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus())) return nStatus;\n");
    // Multiples parameters so fill the methods prototype
    if ( isAllTreatedAsOutParams ) {
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
        writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+" out"+i+";\n");
      }
    }
    writer.write("\ttry\n\t{\n"); //nithya
    if(returntype != null){  /* Invoke the service when return type not void */
      returnParamName = returntype.getElementName().getLocalPart();
      writer.write("\t"+outparamType+((returntypeisarray || returntypeissimple)?" ":" *")+ "ret = "+"pWs->"+methodName+"(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size() - 1; i++) {
          writer.write("v" + i + ",");
        }
        writer.write("v" + ( paramsB.size() - 1));
      }
      writer.write(");\n");
      /* set the result */
      if (returntypeissimple){
        writer.write("\treturn pIWSSZ->addOutputParam(\""+returnParamName+"\", (void*)&ret, "+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
      }else if(returntypeisarray){
        Type arrayType = WrapperUtils.getArrayType(retType);
        QName qname = arrayType.getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
        }
        else if (arrayType.isSimpleType()){//SimpleType in the schema
          containedType = CUtils.getclass4qname(arrayType.getBaseType());
          writer.write("\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\treturn pIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&ret),"+
          "(void*) Axis_Serialize_"+containedType+", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+returnParamName+"\", Axis_URI_"+containedType+");\n");
        }
      }else if(returntype.isAnyType()){
        writer.write("\treturn pIWSSZ->addOutputAnyObject(ret);\n");       
      }
      else{
        //complex type
        writer.write("\treturn pIWSSZ->addOutputCmplxParam(ret, (void*)Axis_Serialize_"+outparamType+", (void*)Axis_Delete_"+outparamType+", \""+returnParamName+"\", Axis_URI_"+outparamType+");\n");
      }
    }else if (isAllTreatedAsOutParams){
      writer.write("\tpWs->" + methodName + "(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size(); i++) {
          writer.write("v" + i + ",");
        }
      }
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size()-1; i++) {
        writer.write("&out" + i +",");
      }
      writer.write("&out" + ( paramsC.size()-1));
      writer.write(");\n");
      paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        ParameterInfo param = (ParameterInfo)paramsC.get(i);
        retType = wscontext.getTypemap().getType(param.getSchemaName());
        if (retType != null){
          if (retType.isSimpleType()){
            returntypeissimple = true;
            outparamType = CUtils.getclass4qname(retType.getBaseType());
          }
          else{
            outparamType = retType.getLanguageSpecificName();
            returntypeisarray = retType.isArray();
            returntypeissimple = CUtils.isSimpleType(outparamType);
          }
        }
        else{
          outparamType = param.getLangName();
          returntypeissimple = CUtils.isSimpleType(outparamType);
        }
        returnParamName = param.getElementName().getLocalPart();
        if (returntypeissimple){
          writer.write("\tpIWSSZ->addOutputParam(\""+returnParamName+"\", (void*)&out"+i+", "+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
        }else if(returntypeisarray){
          Type arrayType = WrapperUtils.getArrayType(retType);
          QName qname = arrayType.getName();
          String containedType = null;
          if (CUtils.isSimpleType(qname)){
            containedType = CUtils.getclass4qname(qname);
            writer.write("\tpIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&out"+i+"),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
          }
          else if (arrayType.isSimpleType()){//SimpleType in the schema
            containedType = CUtils.getclass4qname(arrayType.getBaseType());
            writer.write("\tpIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&out"+i+"),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
          }
          else{
            containedType = qname.getLocalPart();
            writer.write("\tpIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&out"+i+"),"+
            "(void*) Axis_Serialize_"+containedType+", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+returnParamName+"\", Axis_URI_"+containedType+");\n");
          }
        }
        else if (param.isAnyType()){
          //anyType
          writer.write("\tpIWSSZ->addOutputAnyObject(out"+i+");\n");         
        }
        else{
          //complex type
          writer.write("\tpIWSSZ->addOutputCmplxParam(out"+i+", (void*)Axis_Serialize_"+outparamType+", (void*)Axis_Delete_"+outparamType+", \""+returnParamName+"\", Axis_URI_"+outparamType+");\n");
        }
      }     
      writer.write("\treturn AXIS_SUCCESS;\n");
    }else{//method does not return anything
      /* Invoke the service when return type is void */
       writer.write("\tpWs->" + methodName + "(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size() - 1; i++) {
          writer.write("v" + i + ",");
        }
        writer.write("v" + ( paramsB.size() - 1));
      }
      writer.write(");\n");
      writer.write("\treturn AXIS_SUCCESS;\n");
    }
          writer.write("\t}\n");//nithya         
      Iterator paramsFault = minfo.getFaultType().iterator();
      String faultInfoName =null;
      String faultType =null;
      String langName =null;
      String paramName =null;
      while (paramsFault.hasNext()){
          FaultInfo info = (FaultInfo)paramsFault.next();
          faultInfoName =info.getFaultInfo();
          ArrayList paramInfo =info.getParams();
          for (int i= 0; i < paramInfo.size(); i++) {
              ParameterInfo par =(ParameterInfo)paramInfo.get(i);
              paramName  = par.getParamName();
              langName =par.getLangName();
              faultType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(par,wscontext);                              
              writeExceptions(faultType,faultInfoName,paramName,langName);
          }
       }
    writer.write("\tcatch(...){\n"); //nithya
View Full Code Here

   * @throws IOException
   */

  public void writeMethodInWrapper(MethodInfo minfo) throws WrapperFault,IOException {
    boolean isAllTreatedAsOutParams = false;
    ParameterInfo returntype = null;
    int noOfOutParams = minfo.getOutputParameterTypes().size();
    if (0==noOfOutParams){
      returntype = null;
    }
    else if (1==noOfOutParams){
      returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
    }
    else{
      isAllTreatedAsOutParams = true;
    }
    String methodName = minfo.getMethodname();
    Collection params = minfo.getInputParameterTypes();
    Type retType = null;
    String outparamType = null;
    boolean returntypeissimple = false;
    boolean returntypeisarray = false;
    if (returntype != null){
      retType = wscontext.getTypemap().getType(returntype.getSchemaName());
      if (retType != null){
        if (retType.isSimpleType()){ //schema defined simpleType possibly with restrictions
          returntypeissimple = true;
          outparamType = CUtils.getclass4qname(retType.getBaseType());
        }
        else{
          outparamType = retType.getLanguageSpecificName();
          returntypeisarray = retType.isArray();
          returntypeissimple = CUtils.isSimpleType(outparamType);
        }
      }
      else{
        outparamType = returntype.getLangName();
        returntypeissimple = CUtils.isSimpleType(outparamType);
      }
    }
    String paraTypeName;
    ArrayList paramsB = new ArrayList(params);
    Type type;

    writer.write("\n/*forward declaration for the c method "+methodName+" */\n");
    //TODO forward declaration writing logic should be changed when arrays come into picture
    if (returntype == null){
      writer.write("extern void "+methodName+"(");
    }
    else{
      writer.write("extern "+outparamType+((returntypeissimple||returntypeisarray)?" ":"* ")+methodName+"(");
    }

    for (int i = 0; i < paramsB.size(); i++) {
      if (i>0) writer.write(",");
      type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
      paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
      if((CUtils.isSimpleType(paraTypeName)) || (type != null && type.isSimpleType())){
        //for simple types 
        writer.write(paraTypeName);
      }else if(type != null && type.isArray()){
        writer.write(paraTypeName);
      }else{
        writer.write(paraTypeName+"*");
      }
    }
    if ( isAllTreatedAsOutParams ) {
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      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)+"*");
      }
    }   
    writer.write(");\n");
    writer.write("\n/*\n");
    writer.write(" * This method wrap the service method \n");
    writer.write(" */\n");
    //method signature
    writer.write("int "+ methodName + CUtils.WRAPPER_METHOD_APPENDER+ "(IWrapperSoapDeSerializer DZ, IWrapperSoapSerializer SZ)\n{\n");
    writer.write("\tint nStatus;\n");
    boolean aretherearrayparams = false;
    String parameterName;
    String elementName;
    String returnParamName;
    for (int i = 0; i < paramsB.size(); i++) {
      ParameterInfo param = (ParameterInfo)paramsB.get(i);
      type = this.wscontext.getTypemap().getType(param.getSchemaName());
      paraTypeName = param.getLangName();
      if((CUtils.isSimpleType(paraTypeName)) || (type != null && type.isSimpleType())){
        //for simple types 
        writer.write("\t"+paraTypeName+" v"+i+";\n");
      }else if(type != null && type.isArray()){
        //for arrays
        aretherearrayparams = true;
        writer.write("\t"+paraTypeName+" v"+i+";\n");
      }else{
        //for complex types
        writer.write("\t"+paraTypeName+"* v"+i+";\n");       
      }
    }
    if(returntype != null){
      writer.write("\t"+outparamType+((returntypeisarray || returntypeissimple)?" ":"* ")+ "ret;\n");
    }
    if (aretherearrayparams){
      writer.write("\tAxis_Array array;\n");
    }
    // Multiples parameters so fill the methods prototype
    if ( isAllTreatedAsOutParams ) {
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        type = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).getSchemaName());
        writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo)paramsC.get(i),wscontext)+" out"+i+";\n");
      }
    } 
    writer.write("\tif (AXIS_SUCCESS != DZ._functions->checkMessageBody(DZ._object, \""+minfo.getInputMessage().getLocalPart()+"\", \""+minfo.getInputMessage().getNamespaceURI()+"\")) return AXIS_FAIL;\n");
    writer.write("\tSZ._functions->CreateSoapMethod(SZ._object, \""+minfo.getOutputMessage().getLocalPart()+"\", \""+minfo.getOutputMessage().getNamespaceURI()+"\");\n");
    //create and populate variables for each parameter
    for (int i = 0; i < paramsB.size(); i++) {
      ParameterInfo param = (ParameterInfo)paramsB.get(i);
      type = this.wscontext.getTypemap().getType(param.getSchemaName());
      if (type != null && type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        paraTypeName = CUtils.getclass4qname(type.getBaseType());;
      }
      else{
        paraTypeName = param.getLangName();
      }
      parameterName = param.getParamName();
      elementName = param.getElementName().getLocalPart();
      if (type != null && type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        writer.write("\tv"+i+" = DZ._functions->"+CUtils.getParameterGetValueMethodName(paraTypeName, false)+"(DZ._object,\""+elementName+"\", 0);\n");
      }
      else if((CUtils.isSimpleType(param.getLangName()))){
        //for simple types 
        writer.write("\tv"+i+" = DZ._functions->"+CUtils.getParameterGetValueMethodName(paraTypeName, false)+"(DZ._object,\""+elementName+"\", 0);\n");
      }else if(type != null && type.isArray()){
        QName qname = WrapperUtils.getArrayType(type).getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\tarray = DZ._functions->getBasicArray(DZ._object, "+CUtils.getXSDTypeForBasicType(containedType)+", \""+elementName+"\", 0);\n");
          writer.write("\tmemcpy(&v"+i+", &array, sizeof(Axis_Array));\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\tarray = DZ._functions->getCmplxArray(DZ._object, (void*)Axis_DeSerialize_"+containedType+
            "\n\t\t, (void*)Axis_Create_"+containedType+", (void*)Axis_Delete_"+containedType+
            "\n\t\t, (void*)Axis_GetSize_"+containedType+", \""+elementName+"\", Axis_URI_"+containedType+");\n");
          writer.write("\tmemcpy(&v"+i+", &array, sizeof(Axis_Array));\n");
        }
      }else if (param.isAnyType()){
        //for anyType
        writer.write("\tv"+i+" = ("+paraTypeName+"*)DZ._functions->getAnyObject(DZ._object);\n");       
      }else{
        //for complex types
        writer.write("\tv"+i+" = ("+paraTypeName+"*)DZ._functions->getCmplxObject(DZ._object, (void*)Axis_DeSerialize_"+paraTypeName+
          "\n\t\t, (void*)Axis_Create_"+paraTypeName+", (void*)Axis_Delete_"+paraTypeName+
          "\n\t\t,\""+elementName+"\", Axis_URI_"+paraTypeName+");\n");
      }
    }
    writer.write("\tif (AXIS_SUCCESS != (nStatus = DZ._functions->getStatus(DZ._object))) return nStatus;\n");       
    if(returntype != null){
      returnParamName = returntype.getElementName().getLocalPart();
      /* Invoke the service when return type not void */
      writer.write("\tret = "+methodName+"(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size() - 1; i++) {
          writer.write("v" + i + ",");
        }
        writer.write("v" + ( paramsB.size() - 1));
      }
      writer.write(");\n");
      /* set the result */
      if (returntypeissimple){
        writer.write("\treturn SZ._functions->addOutputParam(SZ._object, \""+returnParamName+"\", (void*)&ret, "+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
      }else if(returntypeisarray){
        Type arrayType = WrapperUtils.getArrayType(retType);
        QName qname = arrayType.getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
        }
        else if (arrayType.isSimpleType()){//SimpleType in the schema
          containedType = CUtils.getclass4qname(arrayType.getBaseType());
          writer.write("\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\treturn SZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&ret), (void*) Axis_Serialize_"+containedType
          +", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+returnParamName+"\", Axis_URI_"+containedType+");\n");
        }
      }else if(returntype.isAnyType()){
        writer.write("\treturn SZ._functions->addOutputAnyObject(SZ._object, ret);\n");       
      }
      else{
        //complex type
        writer.write("\treturn SZ._functions->addOutputCmplxParam(SZ._object, ret, (void*)Axis_Serialize_"+outparamType+", (void*)Axis_Delete_"+outparamType+", \""+returnParamName+"\", Axis_URI_"+outparamType+");\n");
      }
    }else if (isAllTreatedAsOutParams){
      writer.write("\t" + methodName + "(");
      if (0<paramsB.size()){
        for (int i = 0; i <  paramsB.size(); i++) {
          writer.write("v" + i + ",");
        }
      }
      ArrayList paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size()-1; i++) {
        writer.write("&out" + i +",");
      }
      writer.write("&out" + ( paramsC.size()-1));
      writer.write(");\n");
      paramsC = (ArrayList)minfo.getOutputParameterTypes();
      for (int i = 0; i < paramsC.size(); i++) {
        ParameterInfo param = (ParameterInfo)paramsC.get(i);
        retType = wscontext.getTypemap().getType(param.getSchemaName());
        if (retType != null){
          if (retType.isSimpleType()){
            returntypeissimple = true;
            outparamType = CUtils.getclass4qname(retType.getBaseType());
          }
          else{
            outparamType = retType.getLanguageSpecificName();
            returntypeisarray = retType.isArray();
            returntypeissimple = CUtils.isSimpleType(outparamType);
          }
        }
        else{
          outparamType = param.getLangName();
          returntypeissimple = CUtils.isSimpleType(outparamType);
        }
        returnParamName = param.getElementName().getLocalPart();
        if (returntypeissimple){
          writer.write("\tSZ._functions->addOutputParam(SZ._object, \""+returnParamName+"\", (void*)&out"+i+", "+CUtils.getXSDTypeForBasicType(outparamType)+");\n");
        }else if(returntypeisarray){
          QName qname = WrapperUtils.getArrayType(retType).getName();
          String containedType = null;
          if (CUtils.isSimpleType(qname)){
            containedType = CUtils.getclass4qname(qname);
            writer.write("\tSZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&out"+i+"), "+CUtils.getXSDTypeForBasicType(containedType)+ ", \""+returnParamName+"\");\n");
          }
          else{
            containedType = qname.getLocalPart();
            writer.write("\tSZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&out"+i+"),"+
            "(void*) Axis_Serialize_"+containedType+", (void*) Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+returnParamName+"\", Axis_URI_"+containedType+");\n");
          }
        }
        else if (param.isAnyType()){
          //anyType
          writer.write("\tSZ._functions->addOutputAnyObject(SZ._object, out"+i+");\n");         
        }
        else{
          //complex type
View Full Code Here

        int noOfOutParams = minfo.getOutputParameterTypes().size();
        //write return type
        if(0==noOfOutParams)
          writer.write("\tvoid ");
        else if(1==noOfOutParams){
          ParameterInfo returnParam = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
          String outparam = returnParam.getLangName();
          writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(returnParam,wscontext)+" ");
        }
        else{
          isAllTreatedAsOutParams = true;
          writer.write("\tvoid ");
        }
        //write return type
        writer.write(minfo.getMethodname()+"(");
           
        //write parameter names
        Iterator params = minfo.getInputParameterTypes().iterator();
        if(params.hasNext()){
            ParameterInfo fparam = (ParameterInfo)params.next();
          writer.write(WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext)+" Value"+0);
        }
        for(int j =1; params.hasNext();j++){
          ParameterInfo nparam = (ParameterInfo)params.next();
          writer.write(","+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+" Value"+j);
        }
        if (isAllTreatedAsOutParams){
          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(");\n");
      }
View Full Code Here

        int noOfOutParams = minfo.getOutputParameterTypes().size();
        //write return type
        if(0==noOfOutParams)
          writer.write("\tvoid ");
        else if(1==noOfOutParams){
          ParameterInfo returnParam = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
          String outparam = returnParam.getLangName();
          writer.write("\t"+WrapperUtils.getClassNameFromParamInfoConsideringArrays(returnParam,wscontext)+" ");
        }
        else{
          isAllTreatedAsOutParams = true;
          writer.write("\tvoid ");
        }
        //write return type
        writer.write(minfo.getMethodname()+"(");
           
        //write parameter names
        Iterator params = minfo.getInputParameterTypes().iterator();
        if(params.hasNext()){
            ParameterInfo fparam = (ParameterInfo)params.next();
          writer.write(WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext)+" Value"+0);
        }
        for(int j =1; params.hasNext();j++){
          ParameterInfo nparam = (ParameterInfo)params.next();
          writer.write(","+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+" Value"+j);
        }
        if (isAllTreatedAsOutParams){
          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(");\n");
      }
View Full Code Here

      writer.write("extern int get_" + classname + "_Status(void* pStub);\n");

        for(int i = 0; i < methods.size(); i++){
          minfo = (MethodInfo)this.methods.get(i);
        boolean isAllTreatedAsOutParams = false;
        ParameterInfo returntype = null;
        int noOfOutParams = minfo.getOutputParameterTypes().size();
        if (0==noOfOutParams){
          returntype = null;
          writer.write("extern void ");
        }
        else if (1==noOfOutParams){
          returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
          String outparam = returntype.getLangName();
          writer.write("extern "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(returntype,wscontext)+" ");
        }
        else{
          isAllTreatedAsOutParams = true;
          writer.write("extern void ");
        }
          writer.write(minfo.getMethodname()+"(void* pStub");
           
          //write parameter names
          Iterator params = minfo.getInputParameterTypes().iterator();
          if(params.hasNext()){
              ParameterInfo fparam = (ParameterInfo)params.next();
            writer.write(", "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext)+" Value"+0);
          }
          for(int j =1; params.hasNext();j++){
            ParameterInfo nparam = (ParameterInfo)params.next();
            writer.write(", "+WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext)+" Value"+j);
          }
          if(isAllTreatedAsOutParams){
          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(");\n");
        }
View Full Code Here

   * @throws IOException
   */

  public void writeMethodInWrapper(MethodInfo minfo) throws WrapperFault,IOException {
    boolean isAllTreatedAsOutParams = false;
    ParameterInfo returntype = null;
    int noOfOutParams = minfo.getOutputParameterTypes().size();
    if (0==noOfOutParams){
      returntype = null;
    }
    else if (1==noOfOutParams){
      returntype = (ParameterInfo)minfo.getOutputParameterTypes().iterator().next();
    }
    else{
      isAllTreatedAsOutParams = true;
    }
    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());
    if (retType != null){
      outparamType = retType.getLanguageSpecificName();
      returntypeisarray = retType.isArray();
    }
    else if (returntype != null){
      outparamType = returntype.getLangName();
    }
    if (returntype != null)
      returntypeissimple = CUtils.isSimpleType(outparamType);
    writer.write("\n/*\n");
    writer.write(" * This method wrap the service method "+ methodName +"\n");
    writer.write(" */\n");
    //method signature
    String paramTypeName;
    boolean typeisarray = false;
    boolean typeissimple = false;
    Type type;
    if (returntype == null){
      writer.write("void");
    }
    else if (returntypeissimple || returntypeisarray){
      writer.write(outparamType)
    }else{
      writer.write(outparamType+"*");
    }
    writer.write(" "+ methodName + "(void* pStub");
    ArrayList paramsB = (ArrayList)params;
    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;
      }
    }
    // 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 (aretherearrayparams || returntypeisarray){
      writer.write("\tAxis_Array array;\n");
    }
    writer.write("\tCall* pCall = (Call*)pStub;\n");
    if (returntype != null){
      writer.write("\t");
      if(returntypeisarray){
        //for arrays
        writer.write(outparamType+" RetArray = {NULL, 0};\n");
      }else if(!returntypeissimple){
        writer.write(outparamType+"* pReturn = NULL;\n");
        //for complex types
      }else{
        //for simple types
        writer.write(outparamType+" Ret;\n");
        //TODO initialize return parameter appropriately.
      }
    }
    String channelSecurityType = (WrapperConstants.CHANNEL_SECURITY_SSL.equals(wscontext.getWrapInfo().getChannelSecurity()))?
                    "SSL_CHANNEL" : "NORMAL_CHANNEL";
    writer.write("\t/* Following will establish the connections with the server too */\n");
    writer.write("\tif (AXIS_SUCCESS != pCall->_functions->initialize(pCall->_object, C_DOC_PROVIDER, "+channelSecurityType+")) return ");
    if (returntype != null){
      writer.write((returntypeisarray?"RetArray":returntypeissimple?"Ret":"pReturn")+";\n");
    }
    else{
      writer.write(";\n");
    }
    writer.write("\tpCall->_functions->setTransportProperty(pCall->_object,SOAPACTION_HEADER , \""+minfo.getSoapAction()+"\");\n");
    writer.write("\tpCall->_functions->setSOAPVersion(pCall->_object, SOAP_VER_1_1);\n"); //TODO check which version is it really.
    writer.write("\tpCall->_functions->setOperation(pCall->_object, \""+minfo.getInputMessage().getLocalPart()+"\", \""+ minfo.getInputMessage().getNamespaceURI()+"\");\n");
    for (int i = 0; i < paramsB.size(); i++) {
      ParameterInfo param = (ParameterInfo)paramsB.get(i);
      type = wscontext.getTypemap().getType(param.getSchemaName());
      if (type != null){
        if (type.isSimpleType()){//schema defined simpleType possibly with restrictions
          paramTypeName = CUtils.getclass4qname(type.getBaseType());
        }
        else{
          paramTypeName = type.getLanguageSpecificName();
        }
        typeisarray = type.isArray();
      }
      else {
        paramTypeName = param.getLangName();
        typeisarray = false;
      }
      typeissimple = CUtils.isSimpleType(paramTypeName);
      if(typeisarray){
        //arrays
        QName qname = WrapperUtils.getArrayType(type).getName();
        String containedType = null;
        if (CUtils.isSimpleType(qname)){
          containedType = CUtils.getclass4qname(qname);
          writer.write("\tpCall->_functions->addBasicArrayParameter(pCall->_object, ");     
          writer.write("(Axis_Array*)(&Value"+i+"), "+CUtils.getXSDTypeForBasicType(containedType)+", \""+param.getElementName().getLocalPart()+"\"");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\tpCall->_functions->addCmplxArrayParameter(pCall->_object, ");
          writer.write("(Axis_Array*)(&Value"+i+"), (void*)Axis_Serialize_"+containedType+", (void*)Axis_Delete_"+containedType+", (void*) Axis_GetSize_"+containedType+", \""+param.getElementName().getLocalPart()+"\", Axis_URI_"+containedType);
        }
      }else if(typeissimple){
        //for simple types 
        writer.write("\tpCall->_functions->addParameter(pCall->_object, ");     
        writer.write("(void*)&Value"+i+", \"" + param.getElementName().getLocalPart()+"\", "+CUtils.getXSDTypeForBasicType(paramTypeName));
      }else if (param.isAnyType()){
        //for anyTtype
        writer.write("\tpCall->_functions->addAnyObject(pCall->_object, Value"+i);
      }else{
        //for complex types
        writer.write("\tpCall->_functions->addCmplxParameter(pCall->_object, ");     
        writer.write("Value"+i+", (void*)Axis_Serialize_"+paramTypeName+", (void*)Axis_Delete_"+paramTypeName+", \"" + param.getElementName().getLocalPart()+"\", 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 ( 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){
          if (type.isSimpleType()){
            currentParaType = CUtils.getclass4qname(type.getBaseType());
          }
          else{
            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 if (currentType.isAnyType()){
          //for anyTtype
          writer.write("\t\t\t" + currentParamName + " = ("+currentParaType+"*)pCall->_functions->getAnyObject(pCall->_object);\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");
    }
View Full Code Here

TOP

Related Classes of org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.