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

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


   */
  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 <axis/client/Stub.h>\n");
      writer.write("#include <axis/AxisGenException.h>\n");
      writer.write("/*include Exception header files here*/\n");//damitha
      Type atype;
      Iterator types = this.wscontext.getTypemap().getTypes().iterator();
      HashSet typeSet = new HashSet();
      String typeName = null;
      while(types.hasNext()){
        atype = (Type)types.next();
        if (atype.getLanguageSpecificName().startsWith(">")) continue;
        typeName = WrapperUtils.getLanguageTypeName4Type(atype);
        if (null != typeName) typeSet.add(typeName);
      }
      Iterator itr = typeSet.iterator();
      while(itr.hasNext())
View Full Code Here

  /* (non-Javadoc)
   * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
   */
  protected void writePreprocssorStatements() throws WrapperFault {
    try{
      Type atype;
      Iterator types = this.wscontext.getTypemap().getTypes().iterator();
      HashSet typeSet = new HashSet();
      writer.write("#include <axis/server/AxisUserAPI.h>\n");
      writer.write("#include \"AxisServiceException.h\" \n\n");
      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;   
    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);
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.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++) {
      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
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.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 ......");
            (new ArrayParamWriter(wscontext,type)).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

  /* (non-Javadoc)
   * @see org.apache.axis.wsdl.wsdl2ws.cpp.BasicFileWriter#writePreprocssorStatements()
   */
  protected void writePreprocssorStatements() throws WrapperFault {
    try{
    Type atype;
    Iterator types = this.wscontext.getTypemap().getTypes().iterator();
    writer.write("#include <axis/server/AxisUserAPI.h>\n\n");
    HashSet typeSet = new HashSet();
    String typeName = null;
    while(types.hasNext()){
      atype = (Type)types.next();
      if(!(atype.equals(this.type))){
        if (this.type.isContainedType(atype)){
          typeName = WrapperUtils.getLanguageTypeName4Type(atype);
          if (null != typeName) typeSet.add(typeName);
        }
      }
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.