Beispiel #1
0
void
axis2_populate_axis_service(
    axis2_stub_t * stub,
    const axutil_env_t * env)
{
    axis2_svc_client_t *svc_client = NULL;
    axutil_qname_t *op_qname = NULL;
    axis2_svc_t *svc = NULL;
    axis2_op_t *op = NULL;

    /*Modifying the Service */
    svc_client = axis2_stub_get_svc_client(stub, env);
    svc = axis2_svc_client_get_svc(svc_client, env);

    /*creating the operations */

    op_qname = axutil_qname_create(env, "add", "", NULL);
    op = axis2_op_create_with_qname(env, op_qname);
    axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
    axis2_svc_add_op(svc, env, op);
    axutil_qname_free(op_qname, env);

    op_qname = axutil_qname_create(env, "sub", "", NULL);
    op = axis2_op_create_with_qname(env, op_qname);
    axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
    axis2_svc_add_op(svc, env, op);
    axutil_qname_free(op_qname, env);

    op_qname = axutil_qname_create(env, "mul", "", NULL);
    op = axis2_op_create_with_qname(env, op_qname);
    axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
    axis2_svc_add_op(svc, env, op);
    axutil_qname_free(op_qname, env);

    op_qname = axutil_qname_create(env, "div", "", NULL);
    op = axis2_op_create_with_qname(env, op_qname);
    axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
    axis2_svc_add_op(svc, env, op);
    axutil_qname_free(op_qname, env);
}
      void
      axis2_stub_populate_services_for_CallbackServiceUserStubService(axis2_stub_t *stub, const axutil_env_t *env)
      {
         axis2_svc_client_t *svc_client = NULL;
         axutil_qname_t *svc_qname =  NULL;
         axutil_qname_t *op_qname =  NULL;
         axis2_svc_t *svc = NULL;
         axis2_op_t *op = NULL;
         axis2_op_t *annon_op = NULL;
         axis2_msg_t *msg_out = NULL;
         axis2_msg_t *msg_in = NULL;
         axis2_msg_t *msg_out_fault = NULL;
         axis2_msg_t *msg_in_fault = NULL;


         /* Modifying the Service */
         svc_client = axis2_stub_get_svc_client (stub, env );
         svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client, env );

         annon_op = axis2_svc_get_op_with_name(svc, env, AXIS2_ANON_OUT_IN_OP);
         msg_out = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT);
         msg_in = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN);
         msg_out_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT_FAULT);
         msg_in_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN_FAULT);

         svc_qname = axutil_qname_create(env,"CallbackServiceUserStubService" ,NULL, NULL);
         axis2_svc_set_qname (svc, env, svc_qname);

         /* creating the operations*/

         
           op_qname = axutil_qname_create(env,
                                         "getEvents" ,
                                         "http://esb.callbackservice.services.hdviper.psnc.pl/",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
             
           axis2_msg_increment_ref(msg_out, env);
           axis2_msg_increment_ref(msg_in, env);
           axis2_msg_increment_ref(msg_out_fault, env);
           axis2_msg_increment_ref(msg_in_fault, env);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT, msg_out);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN, msg_in);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT_FAULT, msg_out_fault);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN_FAULT, msg_in_fault);
           
           axis2_svc_add_op(svc, env, op);

         
      }
      void AXIS2_CALL
      axis2_stub_populate_services_for_IIp2Location(axis2_stub_t *stub, const axutil_env_t *env)
      {
         axis2_svc_client_t *svc_client = NULL;
         axutil_qname_t *svc_qname =  NULL;
         axutil_qname_t *op_qname =  NULL;
         axis2_svc_t *svc = NULL;
         axis2_op_t *op = NULL;
         axis2_op_t *annon_op = NULL;
         axis2_msg_t *msg_out = NULL;
         axis2_msg_t *msg_in = NULL;
         axis2_msg_t *msg_out_fault = NULL;
         axis2_msg_t *msg_in_fault = NULL;
         axis2_policy_include_t *policy_include = NULL;

         axis2_desc_t *desc = NULL;
         axiom_node_t *policy_node = NULL;
         axiom_element_t *policy_root_ele = NULL;
         neethi_policy_t *neethi_policy = NULL;
         axis2_status_t status;

         /* Modifying the Service */
         svc_client = axis2_stub_get_svc_client (stub, env );
         svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client, env );

         annon_op = axis2_svc_get_op_with_name(svc, env, AXIS2_ANON_OUT_IN_OP);
         msg_out = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT);
         msg_in = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN);
         msg_out_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_OUT_FAULT);
         msg_in_fault = axis2_op_get_msg(annon_op, env, AXIS2_MSG_IN_FAULT);

         svc_qname = axutil_qname_create(env,"IIp2Location" ,NULL, NULL);
         axis2_svc_set_qname (svc, env, svc_qname);
		 axutil_qname_free(svc_qname,env);

         /* creating the operations*/

         
           op_qname = axutil_qname_create(env,
                                         "get" ,
                                         "http://ws.apache.org/axis2",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           axutil_qname_free(op_qname,env);

           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
             
           axis2_msg_increment_ref(msg_out, env);
           axis2_msg_increment_ref(msg_in, env);
           axis2_msg_increment_ref(msg_out_fault, env);
           axis2_msg_increment_ref(msg_in_fault, env);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT, msg_out);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN, msg_in);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT_FAULT, msg_out_fault);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN_FAULT, msg_in_fault);
       
           
           axis2_svc_add_op(svc, env, op);
         
           op_qname = axutil_qname_create(env,
                                         "add" ,
                                         "http://ws.apache.org/axis2",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           axutil_qname_free(op_qname,env);

           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_ONLY);
             
           axis2_msg_increment_ref(msg_out, env);
           axis2_msg_increment_ref(msg_in, env);
           axis2_msg_increment_ref(msg_out_fault, env);
           axis2_msg_increment_ref(msg_in_fault, env);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT, msg_out);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN, msg_in);
           axis2_op_add_msg(op, env, AXIS2_MSG_OUT_FAULT, msg_out_fault);
           axis2_op_add_msg(op, env, AXIS2_MSG_IN_FAULT, msg_in_fault);
       
           
           axis2_svc_add_op(svc, env, op);
         
      }
Beispiel #4
0
/* CHANGED */
void
wsf_util_create_op_and_add_to_svc (
    wsf_svc_info_t * svc_info,
    char *action,
    axutil_env_t * env,
    char *op_name,
    VALUE ht_mep)
{
    axis2_svc_t *svc = NULL;
    axis2_op_t *op = NULL;
    axutil_qname_t *op_qname = NULL;
    op_qname = axutil_qname_create (env, op_name, NULL, NULL);
    svc = svc_info->svc;

    if (NULL != svc && NULL != op_name) {
        op = axis2_svc_get_op_with_name (svc_info->svc, env, op_name);
        if (!op) {
            axis2_conf_t *conf = NULL;
            axis2_conf_ctx_t *conf_ctx = NULL;
            axis2_phases_info_t *info = NULL;

            op_qname = axutil_qname_create (env, op_name, NULL, NULL);

            op = axis2_op_create_with_qname (env, op_qname);

            axis2_op_set_msg_recv (op, env, svc_info->msg_recv);

            conf_ctx = wsf_worker_get_conf_ctx (svc_info->ruby_worker, env);

            conf = axis2_conf_ctx_get_conf (conf_ctx, env);

            info = axis2_conf_get_phases_info (conf, env);
            axis2_phases_info_set_op_phases (info, env, op);
            axis2_svc_add_op (svc_info->svc, env, op);

            if (ht_mep) {
                char operation[300];
                VALUE mep_value;
                char *mep;

                AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                 "[wsf_service] ht mep not null, %s", op_name);
                snprintf (operation, sizeof(operation), "%s", op_name);
                if(TYPE(ht_mep) == T_HASH)
                {
                    mep_value = rb_hash_aref(ht_mep, ID2SYM(rb_intern(operation)));
                }
                if(mep_value != Qnil)
                {
                    mep = RSTRING(mep_value)->ptr;
                    if (mep) {
                        AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                         "[wsf_service] op mep %s", mep);
                        if (strcmp (mep, "IN_ONLY") == 0) {
                            axis2_op_set_msg_exchange_pattern (op, env,
                                                               AXIS2_MEP_URI_IN_ONLY);
                            AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                             "[wsf_service] AXIS2_MEP_URI_IN_ONLY");

                        } else if (strcmp (mep, "IN_OUT") == 0) {
                            axis2_op_set_msg_exchange_pattern (op, env,
                                                               AXIS2_MEP_URI_IN_OUT);
                            AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                             "[wsf_service] AXIS2_MEP_URI_IN_OUT");
                        }
                    }
                }
                else {
                    AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                     "[wsf service] message exchange pattern for %s not found",
                                     op_name);
                }
            }
            if (action) {
                axis2_svc_add_mapping (svc_info->svc, env, action, op);
            }
        }
    }
    if(op_qname) {
        axutil_qname_free(op_qname, env);
    }

    return;
}
Beispiel #5
0
bool Axis2UtilsCreateVirtualService(const staff::ServiceWrapper* pServiceWrapper,
                                    const struct axutil_env* pEnv, struct axis2_conf* pConf)
{  
  if (!pServiceWrapper)
  {
    staff::LogError() << "pService is NULL";
    return false;
  }

  const std::string& sServiceName = pServiceWrapper->GetName();

  std::string sServiceGroupName = sServiceName + "SvcGroup";

  std::string sServiceUri = "http://staff.tempui.org:9090/axis2/services/";
  sServiceUri += sServiceName.c_str();
  std::string sWsdlPath = staff::Runtime::Inst().GetComponentHome(pServiceWrapper->GetComponent()->GetName())
      + STAFF_PATH_SEPARATOR + pServiceWrapper->GetName() + ".wsdl";

  axutil_qname_t* pQName = axutil_qname_create(pEnv, sServiceName.c_str(), sServiceUri.c_str(), NULL);
  if (!pQName)
  {
    staff::LogError() << "pQName";
    return false;
  }

  axis2_svc_t* pAxis2Service = axis2_svc_create_with_qname(pEnv, pQName);
  if (!pAxis2Service)
  {
    axutil_qname_free(pQName, pEnv);
    staff::LogError() << "pAxis2Service";
    return false;
  }
  axutil_qname_free(pQName, pEnv);

  // set "virtual" service flag
  static char szParamName[] = "IsStaffVirtualService";
  // allocate data C-way, so axis2/c can free it
  int* pnParam = reinterpret_cast<int*>(AXIS2_MALLOC(pEnv->allocator, sizeof(int)));
  if (!pnParam)
  {
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "can't allocate param";
    return false;
  }
  *pnParam = 1;
  axutil_param_t* pParam = axutil_param_create(pEnv, static_cast<axis2_char_t*>(szParamName), pnParam);
  if (!pParam)
  {
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "pParam";
    return false;
  }

  if (axis2_svc_add_param(pAxis2Service, pEnv, pParam) != AXIS2_SUCCESS)
  {
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "pParam";
    return false;
  }

  { // adding operations
    const staff::DataObject& rdoOperations = pServiceWrapper->GetOperations();
    for (staff::DataObject tdoOperation = rdoOperations.FirstChild();
        !tdoOperation.IsNull(); tdoOperation.SetNextSibling())
    {
      const std::string& sOpName = tdoOperation.GetChildByLocalName("Name").GetText();
      struct axis2_op* pOperation = axis2_op_create(pEnv);
      pQName = axutil_qname_create(pEnv, sOpName.c_str(), NULL, NULL);
      if (!pQName)
      {
        axis2_svc_free(pAxis2Service, pEnv);
        staff::LogError() << "pQName(op)";
        return false;
      }

      if (axis2_op_set_qname(pOperation, pEnv, pQName) != AXIS2_SUCCESS)
      {
        axutil_qname_free(pQName, pEnv);
        axis2_svc_free(pAxis2Service, pEnv);
        staff::LogError() << "axis2_op_set_qname";
        return false;
      }

      axutil_qname_free(pQName, pEnv);

      // add REST params if exists
      std::string sRestMethod;
      std::string sRestLocation;

      {
        const staff::DataObject& rdoOperationConst = tdoOperation;
        staff::DataObject::ConstIterator itRestTmp = rdoOperationConst.FindChildByLocalName("RestMethod");
        if (itRestTmp != rdoOperationConst.End())
        {
          sRestMethod = itRestTmp->GetText();
        }

        itRestTmp = rdoOperationConst.FindChildByLocalName("RestLocation");
        if (itRestTmp != rdoOperationConst.End())
        {
          sRestLocation = itRestTmp->GetText();
        }
      }

      if (!sRestLocation.empty() && !sRestMethod.empty())
      {
        if (axis2_op_set_rest_http_method(pOperation, pEnv, sRestMethod.c_str()) != AXIS2_SUCCESS)
        {
          staff::LogError() << "Failed to set \"RESTMethod\" to service ["
              << sServiceName <<"] operation " << sOpName;
        }
        else
        {
          staff::LogDebug2() << "\"RESTMethod=" << sRestMethod << "\" param set to service ["
              << sServiceName <<"] operation " << sOpName;
        }

        if (axis2_op_set_rest_http_location(pOperation, pEnv, sRestLocation.c_str()) != AXIS2_SUCCESS)
        {
          staff::LogError() << "Failed to set \"RESTLocation\" to service ["
              << sServiceName <<"] operation " << sOpName;
        }
        else
        {
          staff::LogDebug2() << "\"RESTLocation=" << sRestLocation << "\" param set to service ["
              << sServiceName <<"] operation " << sOpName;
        }

        if (axis2_svc_add_rest_mapping(pAxis2Service, pEnv, sRestMethod.c_str(), sRestLocation.c_str(),
                                       pOperation) != AXIS2_SUCCESS)
        {
          staff::LogError() << "Failed to set REST mapping to service ["
              << sServiceName <<"] operation " << sOpName;
        }
      }

      // add service operation
      if (axis2_svc_add_op(pAxis2Service, pEnv, pOperation) != AXIS2_SUCCESS)
      {
        axis2_svc_free(pAxis2Service, pEnv);
        staff::LogError() << "axis2_svc_add_op";
        return false;
      }
    }
  }

  std::string sServiceDescr = pServiceWrapper->GetDescr();
  FILE* pFile = fopen(sWsdlPath.c_str(), "rb");
  if (pFile)
  {
    fclose(pFile);
    sServiceDescr += "&nbsp;<sup>[<a style='font-size: x-small' href='/axis2/services/staff.wsdl.Wsdl/get/"
                     + pServiceWrapper->GetComponent()->GetName() + "/"
                     + pServiceWrapper->GetName() + ".wsdl'>wsdl</a>]</sup>";
    if (axis2_svc_set_svc_wsdl_path(pAxis2Service, pEnv, sWsdlPath.c_str()) != AXIS2_SUCCESS)
    {
      staff::LogError() << "axis2_svc_set_svc_wsdl_path";
    }
  }

  if (axis2_svc_set_svc_desc(pAxis2Service, pEnv, sServiceDescr.c_str()) != AXIS2_SUCCESS)
  {
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "axis2_svc_set_svc_desc";
    return false;
  }

  // creating service group
  axis2_svc_grp_t* pServiceGroup = axis2_svc_grp_create_with_conf(pEnv, pConf);
  if (!pServiceGroup)
  {
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "axis2_svc_grp_create_with_conf";
    return false;
  }

  if (axis2_svc_grp_set_name(pServiceGroup, pEnv, sServiceGroupName.c_str()) != AXIS2_SUCCESS)
  {
    axis2_svc_grp_free(pServiceGroup, pEnv);
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "axis2_svc_grp_set_name";
    return false;
  }

  if (axis2_svc_grp_add_svc(pServiceGroup, pEnv, pAxis2Service) != AXIS2_SUCCESS)
  {
    axis2_svc_grp_free(pServiceGroup, pEnv);
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "axis2_svc_grp_add_svc";
    return false;
  }

  // adding to configuration
  if (axis2_conf_add_svc_grp(pConf, pEnv, pServiceGroup) != AXIS2_SUCCESS)
  {
    axis2_svc_grp_free(pServiceGroup, pEnv);
    axis2_svc_free(pAxis2Service, pEnv);
    staff::LogError() << "axis2_conf_add_svc_grp";
    return false;
  }

  return true;
}
      void axis2_stub_ExchangeTrader_populate_services( axis2_stub_t *stub, const axutil_env_t *env)
      {
         axis2_svc_client_t *svc_client = NULL;
         axutil_qname_t *svc_qname =  NULL;
         axutil_qname_t *op_qname =  NULL;
         axis2_svc_t *svc = NULL;
         axis2_op_t *op = NULL;

         /* Modifying the Service */
         svc_client = axis2_stub_get_svc_client (stub, env );
         svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client, env );
         axutil_qname_create(env,"ExchangeTrader" ,NULL, NULL);
         axis2_svc_set_qname (svc, env, svc_qname);

         /* creating the operations*/

         

           op_qname = axutil_qname_create(env,
                                         "buy" ,
                                         "http://www.wso2.org",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_ONLY);
             
           axis2_svc_add_op(svc, env, op);

         

           op_qname = axutil_qname_create(env,
                                         "login" ,
                                         "http://www.wso2.org",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_ONLY);
             
           axis2_svc_add_op(svc, env, op);

         

           op_qname = axutil_qname_create(env,
                                         "registerClient" ,
                                         "http://www.wso2.org",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
             
           axis2_svc_add_op(svc, env, op);

         

           op_qname = axutil_qname_create(env,
                                         "registerFeedTarget" ,
                                         "http://www.wso2.org",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_ONLY);
             
           axis2_svc_add_op(svc, env, op);

         

           op_qname = axutil_qname_create(env,
                                         "sell" ,
                                         "http://www.wso2.org",
                                         NULL);
           op = axis2_op_create_with_qname(env, op_qname);
           
               axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_ONLY);
             
           axis2_svc_add_op(svc, env, op);

         
      }
Beispiel #7
0
/**
 * Here we extract all operations defined in module.xml and built execution
 * chains for them by calling axis2_phase_resolver_build_execution_chains_for_module_op()
 * function. Within that function handlers of the modules defined for that
 * operation are added to module operation chains appropriately.
 */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_svc_add_module_ops(
    axis2_svc_t * svc,
    const axutil_env_t * env,
    axis2_module_desc_t * module_desc,
    axis2_conf_t * conf)
{
    axutil_hash_t *map = NULL;
    axutil_hash_index_t *hash_idx = NULL;
    axis2_phase_resolver_t *phase_resolver = NULL;
    axis2_op_t *op_desc = NULL;
    axis2_status_t status = AXIS2_FAILURE;
    const axis2_char_t *svcname = NULL;
    axis2_char_t *modname = NULL;
    axis2_char_t *opname = NULL;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_svc_add_module_ops");
    AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, conf, AXIS2_FAILURE);
    svcname = axis2_svc_get_name(svc, env);
    modname = axutil_qname_get_localpart(axis2_module_desc_get_qname(module_desc, env), env);
    map = axis2_module_desc_get_all_ops(module_desc, env);
    phase_resolver = axis2_phase_resolver_create_with_config_and_svc(env, conf, svc);
    if(!phase_resolver)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creating phase resolver failed for service %s",
                        svcname);
        return AXIS2_FAILURE;
    }
    for(hash_idx = axutil_hash_first(map, env); hash_idx; hash_idx = axutil_hash_next(env, hash_idx))
    {
        void *v = NULL;
        axutil_hash_this(hash_idx, NULL, NULL, &v);
        op_desc = (axis2_op_t *)v;
        opname = axutil_qname_get_localpart(axis2_op_get_qname(op_desc, env), env);
        status = axis2_phase_resolver_build_execution_chains_for_module_op(phase_resolver, env,
                 op_desc);

        if(AXIS2_SUCCESS != status)
        {
            axis2_phase_resolver_free(phase_resolver, env);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                            "Builidng module operation %s failed for module %s", opname, modname);
            return status;
        }

        status = axis2_svc_add_op(svc, env, op_desc);
        if(AXIS2_SUCCESS != status)
        {
            axis2_phase_resolver_free(phase_resolver, env);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Adding operation %s to service %s failed",
                            opname, svcname);
            return status;
        }

    }

    axis2_phase_resolver_free(phase_resolver, env);
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_svc_add_module_ops");
    return AXIS2_SUCCESS;
}
Beispiel #8
0
static axis2_svc_t *
axis2_svc_client_create_annonymous_svc(
    axis2_svc_client_t * svc_client,
    const axutil_env_t * env)
{

    /**
     now add anonymous operations to the axis2 service for use with the
     shortcut client API. NOTE: We only add the ones we know we'll use
     later in the convenience API; if you use
     this constructor then you can't expect any magic!
     */
    axutil_qname_t *tmp_qname;
    axis2_svc_t *svc;
    axis2_op_t *op_out_in, *op_out_only, *op_robust_out_only;
    axis2_phases_info_t *info = NULL;

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"Error creating QName for service");
        return NULL;
    }

    svc = axis2_svc_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);
    if(!svc)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the service");
        return NULL;
    }

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-in operation");
        return NULL;
    }
    op_out_in = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-only operation");
        return NULL;
    }
    op_out_only = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Error creating the QName for robust-out-only operation");
        return NULL;
    }
    op_robust_out_only = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    if(!op_out_in || !op_out_only || !op_robust_out_only)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        if(op_out_in)
        {
            axis2_op_free(op_out_in, env);
        }
        if(op_out_only)
        {
            axis2_op_free(op_out_only, env);
        }
        if(op_robust_out_only)
        {
            axis2_op_free(op_robust_out_only, env);
        }

        return NULL;
    }

    axis2_op_set_msg_exchange_pattern(op_out_in, env, AXIS2_MEP_URI_OUT_IN);
    axis2_op_set_msg_exchange_pattern(op_out_only, env, AXIS2_MEP_URI_OUT_ONLY);
    axis2_op_set_msg_exchange_pattern(op_robust_out_only, env, AXIS2_MEP_URI_ROBUST_OUT_ONLY);

    /* Setting operation phase */
    info = axis2_conf_get_phases_info(svc_client->conf, env);
    axis2_phases_info_set_op_phases(info, env, op_out_in);
    axis2_phases_info_set_op_phases(info, env, op_out_only);
    axis2_phases_info_set_op_phases(info, env, op_robust_out_only);
    axis2_svc_add_op(svc, env, op_out_in);
    axis2_svc_add_op(svc, env, op_out_only);
    axis2_svc_add_op(svc, env, op_robust_out_only);
    return svc;
}