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

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


   * @see org.apache.axis.wsdl.wsdl2ws.SourceWriter#writeSource()
   */
  public void writeSource() throws WrapperFault {
    Iterator enu = wscontext.getTypemap().getTypes().iterator();
    String generator = wscontext.getWrapInfo().getImplStyle();
    Type type;
    while(enu.hasNext()){ 
    try
      type = (Type)enu.next();
      if(wscontext.getWrapInfo().getImplStyle().equals(WrapperConstants.IMPL_STYLE_STRUCT)){
        if(type.isArray()){         
          System.out.println("Array writer called ......");
          QName qname = type.getName();
          if (CUtils.isSimpleType(qname) && !CUtils.isDefinedSimpleType(qname)){
            throw new WrapperFault("No need to create an Array for simple type "+qname+"\n" +
              "It seems that some thing wrong with symbolTable population - Susantha");
          }
          ArrayParamWriter writer = (new ArrayParamWriter(wscontext,type))
          if (!writer.isSimpleTypeArray()) writer.writeSource();
       
        else{
          /* TODO check whether this type is referenced or not. Synthesize only if  reference
           * But of cause that depends on the command line option too  */
          if (type.getLanguageSpecificName().startsWith(">")){
            /* TODO do some processing to this type before synthesizing to remove ">" charactors.
             * And then it should also be synthesized if command line option says to */
            System.out.println("ignoring anonymous type "+ type.getLanguageSpecificName()+"\n")
          }
          else{
            System.out.println("struct writer called ......");
            (new BeanParamWriter(wscontext,type)).writeSource();
            (new ParmHeaderFileWriter(wscontext,type)).writeSource()
View Full Code Here


   * @see org.apache.axis.wsdl.wsdl2ws.SourceWriter#writeSource()
   */
  public void writeSource() throws WrapperFault {
    Iterator enu = wscontext.getTypemap().getTypes().iterator();
    String generator = wscontext.getWrapInfo().getImplStyle();
    Type type;
    while(enu.hasNext()){ 
    try
      type = (Type)enu.next();
      if(wscontext.getWrapInfo().getImplStyle().equals(WrapperConstants.IMPL_STYLE_STRUCT)){
        if(type.isArray()){
          System.out.println("Array writer called ......");
          QName qname = type.getName();
          if (CUtils.isSimpleType(qname) && !CUtils.isDefinedSimpleType(qname)){
            throw new WrapperFault("No need to create an Array for simple type "+qname+"\n" +
              "It seems that some thing wrong with symbolTable population - Susantha");
          }
          ArrayParamWriter writer = (new ArrayParamWriter(wscontext,type))
          if (!writer.isSimpleTypeArray()) writer.writeSource();
       
        else{
          /* TODO check whether this type is referenced or not. Synthesize only if  reference
           * But of cause that depends on the commandline option too  */
          if (type.getLanguageSpecificName().startsWith(">")){
            /* TODO do some processing to this type before synthesizing to remove ">" charactors.
             * And then it should also be synthesized if commandline option says to */
            System.out.println("ignoring anonymous type "+ type.getLanguageSpecificName()+"\n")
          }
          else{
            System.out.println("struct writer called ......");
            (new BeanParamWriter(wscontext,type)).writeSource();
            (new ParmHeaderFileWriter(wscontext,type)).writeSource()
View Full Code Here

   * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
   */
  protected void writePreprocssorStatements() throws WrapperFault {
    try{
      writer.write("#include <axis/client/Stub.h>\n");
      Type atype;
      Iterator types = this.wscontext.getTypemap().getTypes().iterator();
      HashSet typeSet = new HashSet();
      while(types.hasNext()){
        atype = (Type)types.next();
        if (atype.getLanguageSpecificName().startsWith(">")) continue;       
        typeSet.add(atype.getLanguageSpecificName());
      }
      Iterator itr = typeSet.iterator();
      while(itr.hasNext())
      {
        writer.write("#include \""+itr.next().toString()+".h\"\n");
View Full Code Here

   * @param outparam
   * @throws IOException
   */

  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++) {
      type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
      if (type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        paraTypeName = CUtils.getclass4qname(type.getBaseType());;
      }
      else{
        paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
      }
      parameterName = ((ParameterInfo)paramsB.get(i)).getParamName();
      elementName = ((ParameterInfo)paramsB.get(i)).getElementName().getLocalPart();
      if (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(((ParameterInfo)paramsB.get(i)).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{
        //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");
      }
    }
    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{
        //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++) {
        retType = wscontext.getTypemap().getType(((ParameterInfo)paramsC.get(i)).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 = returntype.getLangName();
          returntypeissimple = CUtils.isSimpleType(outparamType);
        }
        returnParamName = ((ParameterInfo)paramsC.get(i)).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+"),"+
View Full Code Here

   */
  protected void writeGlobalCodes() throws WrapperFault {
    Iterator types = wscontext.getTypemap().getTypes().iterator();
    HashSet typeSet = new HashSet();
    String typeName;
    Type type;
    try {
      while(types.hasNext()){
        type = (Type)types.next();
        if (type.isSimpleType()) continue;
        if (type.isArray()) continue;
        typeName = type.getLanguageSpecificName();
        if (typeName.startsWith(">")) continue;
        typeSet.add(typeName);
      }
      Iterator itr = typeSet.iterator();
      while(itr.hasNext())
View Full Code Here

   */
  protected void writePreprocssorStatements() throws WrapperFault {
    try{
      writer.write("#include \""+classname+".h\"\n");
      //As there is no service header file for C the header files for types should be included here itself
      Type atype;
      Iterator types = this.wscontext.getTypemap().getTypes().iterator();
      while(types.hasNext()){
        atype = (Type)types.next();
        if (atype.getLanguageSpecificName().startsWith(">")) continue;
        writer.write("#include \""+atype.getLanguageSpecificName()+".h\"\n");
      }
      writer.write("\n");
    }
    catch(IOException e){
      throw new WrapperFault(e);
View Full Code Here

    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++) {
      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("\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("\tpSZ->_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++) {
      type = this.wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).getSchemaName());
      if (type.isSimpleType()){ //schema defined simpleType possibly with restrictions
        paraTypeName = CUtils.getclass4qname(type.getBaseType());;
      }
      else{
        paraTypeName = ((ParameterInfo)paramsB.get(i)).getLangName();
      }
      parameterName = ((ParameterInfo)paramsB.get(i)).getParamName();
      elementName = ((ParameterInfo)paramsB.get(i)).getElementName().getLocalPart();
      if (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(((ParameterInfo)paramsB.get(i)).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{
        //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 pSZ->_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 pSZ->_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 pSZ->_functions->AddOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"+CUtils.getXSDTypeForBasicType(containedType)+", \""+returnParamName+"\");\n");
        }
        else{
          containedType = qname.getLocalPart();
          writer.write("\treturn pSZ->_functions->AddOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&ret), (void*) Axis_Serialize_"+containedType
View Full Code Here

   */
  protected void writeGlobalCodes() throws WrapperFault {
    Iterator types = wscontext.getTypemap().getTypes().iterator();
    HashSet typeSet = new HashSet();
    String typeName;
    Type type;
    try {
      while(types.hasNext()){
        type = (Type)types.next();
        if (type.isSimpleType()) continue;
        if (type.isArray()) continue;
        typeName = type.getLanguageSpecificName();
        if (typeName.startsWith(">")) continue;
        typeSet.add(typeName);
      }
      Iterator itr = typeSet.iterator();
      while(itr.hasNext())
View Full Code Here

   * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
   */
  protected void writePreprocssorStatements() throws WrapperFault {
    try{
      writer.write("#include <axis/client/Call.h>\n");
      Type atype;
      Iterator types = this.wscontext.getTypemap().getTypes().iterator();
      HashSet typeSet = new HashSet();
      while(types.hasNext()){
        atype = (Type)types.next();
        if (atype.getLanguageSpecificName().startsWith(">")) continue;       
        typeSet.add(atype.getLanguageSpecificName());
      }
      Iterator itr = typeSet.iterator();
      while(itr.hasNext())
      {
        writer.write("#include \""+itr.next().toString()+".h\"\n");
View Full Code Here

    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++) {
      type = wscontext.getTypemap().getType(((ParameterInfo)paramsB.get(i)).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 = ((ParameterInfo)paramsB.get(i)).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)+", \""+((ParameterInfo)paramsB.get(i)).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+", \""+((ParameterInfo)paramsB.get(i)).getElementName().getLocalPart()+"\", Axis_URI_"+containedType);
        }
      }else if(typeissimple){
        //for simple types 
        writer.write("\tpCall->_functions->AddParameter(pCall->_object, ");     
        writer.write("(void*)&Value"+i+", \"" + ((ParameterInfo)paramsB.get(i)).getElementName().getLocalPart()+"\", "+CUtils.getXSDTypeForBasicType(paramTypeName));
      }else{
        //for complex types
        writer.write("\tpCall->_functions->AddCmplxParameter(pCall->_object, ");     
        writer.write("Value"+i+", (void*)Axis_Serialize_"+paramTypeName+", (void*)Axis_Delete_"+paramTypeName+", \"" + ((ParameterInfo)paramsB.get(i)).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;
        }
View Full Code Here

TOP

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

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.