UserController and GetAllUsers
Last Post 04/10/2014 5:55 PM by Joseph Craig. 1 Replies.
Author Messages
Eric Cassidy
Posts:


--
04/10/2014 12:12 PM  
I'm trying to create a web service to pull down user info from the DNN site. I've created the asmx and deployed it and it's dll to the test site. When I call the method that includes UserController.GetUsers(0) I get the following:





System.ServiceModel.FaultException occurred

HResult=-2146233087

Message=System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.

at DotNetNuke.Entities.Users.UserController.GetUsers(Int32 portalId, Int32 pageIndex, Int32 pageSize, Int32& totalRecords, Boolean includeDeleted, Boolean superUsersOnly)

at DotNetNuke.Entities.Users.UserController.GetUsers(Boolean includeDeleted, Boolean superUsersOnly, Int32 portalId)

at WindoTrader.Web.Services.BlueWebAPI.GetAllUsers() in c:\Blue\trunk\WebApplication1\BlueWebAPI.asmx.cs:line 48

--- End of inner exception stack trace ---

Source=mscorlib

StackTrace:

Server stack trace:

at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at DnnToIsSync.com.windotrader.services.BlueWebAPISoap.GetAllUsers(GetAllUsersRequest request)

at DnnToIsSync.com.windotrader.services.BlueWebAPISoapClient.DnnToIsSync.com.windotrader.services.BlueWebAPISoap.GetAllUsers(GetAllUsersRequest request) in c:\Blue\trunk\DnnToIsSync\Service References\com.windotrader.services\Reference.cs:line 385

at DnnToIsSync.com.windotrader.services.BlueWebAPISoapClient.GetAllUsers() in c:\Blue\trunk\DnnToIsSync\Service References\com.windotrader.services\Reference.cs:line 391

at DnnToIsSync.Program.Main(String[] args) in c:\Blue\trunk\DnnToIsSync\Program.cs:line 21

InnerException:






The code in question at line 48 is simply:




var users = UserController.GetUsers(false, false, 0);




The same result is from:




var users = UserController.GetUsers(0);




Am I misusing the UserController?




Any help is appreciated


Joseph Craig
DNN MVP
Posts:11667


--
04/10/2014 5:55 PM  
Clearly something is not initialized properly.

Recommendation 1 is to Google "DNN webservices" and ignore anything that refers to a version less that 7.1 (assuming that you are using a version of DNN that is 7.1 or late).

Check the DNN Wiki at dnnsoftware.com.

Look in the developer forums at dnnsoftware.com and the Community Exchange. Your questions there might get a better response.

Also, check out dnn-connect.org.

Joe Craig, Patapsco Research Group
Complete DNN Support


---