private ClientConfig createClientConfig(CodeGenContext codeGenCtx) {

    InputOptions inputOptions = codeGenCtx.getInputOptions();

    ClientConfig clientConfig = new ClientConfig();
    clientConfig.setGroup(inputOptions.getClientCfgGroupName());
    // put serviceNametag in cc.xml only if pre 2.4 consumer
    if (codeGenCtx.getInputOptions().isServiceNameRequired())
      clientConfig.setServiceName(codeGenCtx.getServiceQName().toString());
    String svcInterfaceName =
        CodeGenUtil.toQualifiedClassName(codeGenCtx.getServiceInterfaceClassName());
    clientConfig.setServiceInterfaceClassName(svcInterfaceName);
    if (inputOptions.getSvcCodeGenDefType() == null) {
      clientConfig.setServiceLocation(inputOptions.getServiceLocation());
      clientConfig.setWsdlLocation(inputOptions.getWSDLLocation());
    } else {
      ServiceCodeGenDefType svcCodeGenDef = inputOptions.getSvcCodeGenDefType();
      clientConfig.setServiceLocation(svcCodeGenDef.getServiceInfo().getServiceLocation());
      clientConfig.setWsdlLocation(svcCodeGenDef.getServiceInfo().getWsdlLocation());
    }

    ClientGroupConfig clientGrpCfg = createClientGroupConfig(codeGenCtx);
    clientConfig.setClientInstanceConfig(clientGrpCfg);

    return clientConfig;
  }
  private String getUpdatedClientConfigTemplate(
      CodeGenContext codeGenCtx, ClientConfigList clientCfgList) throws CodeGenFailedException {
    try {
      if (clientCfgList == null || clientCfgList.getClientConfig().size() == 0) {
        throw new CodeGenFailedException("The content of 'ClientConfigList' is empty.");
      }

      String contents = CodeGenUtil.getTemplateContent(CLIENT_CONFIG_TEMPLATE);
      ClientConfig clientConfig = clientCfgList.getClientConfig().get(0);

      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents, CONFIG_GROUP_NAME, clientConfig.getGroup(), CONFIG_GROUP_NAME_ATTR);

      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents,
              CONFIG_SERVICE_NAME,
              clientConfig.getServiceName(),
              CONFIG_SERVICE_NAME_ATTR);
      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents,
              SERVICE_INT_NAME,
              clientConfig.getServiceInterfaceClassName(),
              SERVICE_INT_NAME_NODE);
      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents, WSDL_LOCATION, clientConfig.getWsdlLocation(), WSDL_LOCATION_NODE);
      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents, SERVICE_LOCATION, clientConfig.getServiceLocation(), SERVICE_LOCATION_NODE);

      ClientGroupConfig clientInstanceConfig = clientConfig.getClientInstanceConfig();
      InvocationOptionConfig invocationOptions = null;
      PreferredTransportConfig preferredTransport = null;

      if (clientInstanceConfig != null) {
        invocationOptions = clientConfig.getClientInstanceConfig().getInvocationOptions();
      }
      if (invocationOptions != null) {
        preferredTransport = invocationOptions.getPreferredTransport();

        contents =
            CodeGenConfigUtil.replaceTemplate(
                contents,
                REQ_DATA_BINDING,
                invocationOptions.getRequestDataBinding(),
                REQ_DATA_BINDING_NODE);
        contents =
            CodeGenConfigUtil.replaceTemplate(
                contents,
                RESP_DATA_BINDING,
                invocationOptions.getResponseDataBinding(),
                RESP_DATA_BINDING_NODE);
        contents =
            CodeGenConfigUtil.replaceTemplate(
                contents, CONSUMER_ID, invocationOptions.getConsumerId(), CONSUMER_ID_NODE);
        contents =
            CodeGenConfigUtil.replaceTemplate(
                contents,
                INVOCATION_USE_CASE,
                invocationOptions.getInvocationUseCase(),
                INVOCATION_USE_CASE_NODE);
      }

      String transportName = null;
      if (preferredTransport != null) {
        transportName = preferredTransport.getName();
      }
      contents =
          CodeGenConfigUtil.replaceTemplate(
              contents, PREFERRED_TRANSPORT_NAME, transportName, PREFERRED_TRANSPORT_NAME_ATTR);
      return contents;
    } catch (Throwable e) {
      throw new CodeGenFailedException(
          "Failed in retriveing the client config template "
              + CLIENT_CONFIG_TEMPLATE
              + e.getMessage(),
          e);
    }
  }