Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Creating webservices using dnn classesCreating webservices using dnn classes
Previous
 
Next
New Post
12/29/2011 3:50 AM
 

Good morning,

I need to create a webservice, it must be located out of dnn installation (I can´t use Iweb). I would like to use dnn classes.
In one webmethod, I have to create users. In bin folder, I've added all dnn dll's

[WebMethod]
        public bool Alta_Colegiado(string dni, string password, string idColegiado, string email, string display_name,string telefono)
        {
            int PortalID_const = 0;
            int RolID_const=1;
            try
            {
               
                    UserInfo objUserDnn = new UserInfo();
                    //objUserDnn.Profile.InitialiseProfile(PortalID_const);
                    objUserDnn.PortalID = PortalID_const;
                    objUserDnn.Membership.Username = dni;
                    objUserDnn.FirstName = idColegiado;
                    objUserDnn.Membership.Password = decodificar(password);
                    objUserDnn.Membership.Email = email;
                    objUserDnn.Membership.Approved = true;
                    objUserDnn.Username = dni;

                    objUserDnn.Profile.PreferredLocale = "es-ES";
                    objUserDnn.DisplayName = display_name;
                    objUserDnn.Email = email;
                    objUserDnn.AffiliateID = 0;
                    objUserDnn.Profile.Telephone=telefono;                           

                    UserCreateStatus objUserCreateStatus= UserController.CreateUser(ref objUserDnn);

                    if (objUserCreateStatus == UserCreateStatus.Success)
                    {
                        RoleController rc = new RoleController();
                        rc.AddUserRole(PortalID_const,objUserDnn.UserID,RolID_const,DateTime.Parse("31/12/2090"));
                        return true;
                    }
                    else
                        return false;
                   
               
            }
            catch (Exception e)
            {               
                FicheroRegistro fich_reg = (FicheroRegistro)Application["FicheroRegistro"];
                lock (fich_reg)
                {
                    fich_reg.Escribir(e.Message.Replace("\r\n", "\r\n\t"));
                }
                return false;           
            }
        }

using lines:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Security;
using Interesa.Architecture.BCL.Extranet;
using ws.coiina.es.des.Util;
using System.Web.UI;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security.Membership;
using DotNetNuke.Security.Roles;

This line:

UserCreateStatus objUserCreateStatus= UserController.CreateUser(ref objUserDnn);

 

throw one exception (nullreferenceexception)

Can you help me???
How should the webconfig file be?

 
New Post
12/29/2011 6:34 AM
 

This is the exception I have:

((System.Exception)(ex)).StackTrace
 
  en DotNetNuke.Common.Globals.get_Status()
   en DotNetNuke.Entities.Portals.PortalController.GetEffectivePortalId(Int32 portalId)
   en DotNetNuke.Entities.Profile.ProfileController.GetUserProfile(UserInfo& user)
   en DotNetNuke.Entities.Users.UserInfo.get_Profile()
   en DotNetNuke.Entities.Users.UserInfo.set_FirstName(String value) 

 

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Creating webservices using dnn classesCreating webservices using dnn classes


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out