Creating logins/passwords in iMIS in iMIS 15

Has anyone tried to create the passwords/keys used in iMIS 15 in mass? We're trying to avoid having a customer have to go into every record and create the login/password info.
Thanks,
Terry

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Eric, Thanks for the info. I

Eric,
Thanks for the info.
I have populated the Name_Security, Name_Security_Groups tables as we would in the past.

I then created the page you mention in your second link. I took out the demographic tables b/c they didn't apply. I modified the query to pull the Name_Security.web_login, Name_Security.password as the values in the call to the webservice.

The page runs - with no errors however when I do some troubleshooting I found that once it gets to the cfinvokeargument tab - it fails. It doesn't give me an error though. :(

Any thoughts, this is all we need to go live.
Thanks,
Terry

Terry Hammond
enSYNC Corporation
Fort Worth, TX
terry@ensync-corp.com

Can you look in both the

Can you look in both the Asi.Webroot.log file (in C:\Program Files\ASI\iMIS15\ on the application server) and the Application Windows event log and see if there's anything that looks relevant?

The Event Viewer displays an

The Event Viewer displays an error with the following information:

Event code: 4006
Event message: Membership credential verification failed.
Event time: 3/18/2008 2:49:32 PM
Event time (UTC): 3/18/2008 7:49:32 PM
Event ID: ec5744c2e97545a08743c3c501319e33
Event sequence: 256
Event occurrence: 9
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1/Root/iMIS15_2-2-128503207498789258
Trust level: Full
Application Virtual Path: /iMIS15_2
Application Path: C:\Program Files\ASI_2\iMIS15\net\
Machine name: SWSQL

Process information:
Process ID: 4172
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL: http://38.96.209.143/IMIS15_2/AsiCommon/Services/Membership/MembershipWebservice.asmx
Request path: /IMIS15_2/AsiCommon/Services/Membership/MembershipWebservice.asmx
User host address: 65.205.109.107
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Name to authenticate: 10006

-------

Pretty much the same error in each viewer error. Still looking in to the iMIS log.

Terry Hammond
enSYNC Corporation
Fort Worth, TX
terry@ensync-corp.com

Terry, according to at least

Terry, according to at least one forum post I found (http://forums.asp.net/t/1035351.aspx), that error might be caused by not having the "applicationName" in your <membership< provider's configuration set to something other than "/". Can you check that in the web.config file?

I'm having the same problem

Eric,
I'm getting the same problem. My error is "MembershipWebService (ValidateUser) could not generate stub objects for web service invocation. 100009) (100009 is the record ID for the iMIS record that I'm trying to update)

It has an applicationName="iMIS", any ideas?

-------------------------------------

[membership defaultProvider="CustomizedProvider"]
[providers]
[add name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DataSource.iMIS.Connection" applicationName="iMIS" requiresQuestionAndAnswer="false" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" /]
[/providers]
[/membership]

Progress, I think...

Originally I was attempting to use the membershipwebservice to RegisterWebUser in the production web site while my CM site was using a development db. After changing to update the dev db, it works fine. It seems like I should be able to update the production db with the same list of logins and passwords, shouldn't I?

This is a CF [cfinvoke] based on Mike Rileys post.

thanks!

We created an excel macro that uses RegisterWebUser web service

We are using an excel doc to cut and paste the following fields
iMISID, WebLogin, WebPassword - (these generally come from some legacy system or are set with new values)

iMISID = imisid
WebLogin = Email of record (macro uses this for both weblogin and the email address)

This macro has a row variable that ends at the end of the date...it limits the rows to 11181 -- so change this value if you have more or less records to import.

There's no data source in the macro. The data source is part of the web service. The macro just points at the web service.

~~~~~~~~~~~~~~~~~~~~~~ LoadUserNames MACRO

Sub LoadUserNames()

Dim ContactID As String
Dim userName As String
Dim Password As String
Dim email As String
Dim passwordQuestion As String
Dim passwordAnswer As String
Dim isApproved As Boolean
Dim ws As New clsws_MembershipWebService
Dim rtn As New struct_WebServiceProxyableM
Dim Row As Variant

Row = 2

While Row

Here is the rest

Range("A" + CStr(Row)).Select

On Error Resume Next

ContactID = Range("A" + CStr(Row)).Text
userName = Range("B" + CStr(Row)).Text
Password = Range("C" + CStr(Row)).Text
email = Range("B" + CStr(Row)).Text
passwordQuestion = "enter your question here?"
passwordAnswer = "enter your answer here"
isApproved = True

' call the web service here.
rtn = ws.wsm_RegisterWebUser(ContactID, userName, Password, email, passwordQuestion, passwordAnswer, isApproved)

Row = Row + 1

Wend

End Sub
~~~~~END OF MACRO ~~~~~~~~~~~~~~~~~~~~~~~

This VB code works as well.

You would have to add a recordset and loop through it.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim ContactID As String
Dim userName As String
Dim Password As String
Dim email As String
Dim passwordQuestion As String
Dim passwordAnswer As String
Dim isApproved As Boolean
Dim ws As New Asi.Web.Services.Membership.MembershipWebService
Dim rtn As New Asi.Web.Services.Membership.WebServiceProxyableMembershipUser

'add loop here

ContactID = "20240"
userName = "20240"
Password = "password02"
email = "amillet@a-gcs.com"
passwordQuestion = "enter your question here?"
passwordAnswer = "enter your answer here"
isApproved = True

' call the web service here.
rtn = ws.CreateImisUser(False, True, ContactID, userName, Password, email, passwordQuestion, passwordAnswer, True)

'end loop here

End Sub

Here is the C Sharp code looping through a query


String ContactID;
String userName;
String Password;
String email;
String passwordQuestion;
String passwordAnswer;
String strSQL;
bool isApproved;
Asi.Web.Services.Membership.MembershipWebService ws;
Asi.Web.Services.Membership.WebServiceProxyableMembershipUser rtn;
ws = new Asi.Web.Services.Membership.MembershipWebService();
rtn = new Asi.Web.Services.Membership.WebServiceProxyableMembershipUser();

SqlConnection con = new SqlConnection("Data Source=agcs1;Initial Catalog=iMIS_LCA;User Id=sa; Password=SQL2005;");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT TOP (10) n.ID AS contactID2, n.MEMBER_TYPE, n.full_name, n.EMAIL, n.ZIP FROM Name AS n INNER JOIN Name_Security AS ns ON n.ID = ns.ID where web_login = ''",con);
SqlDataReader rdr = null;
rdr = cmd.ExecuteReader();

while (rdr.Read())
{
Response.Write(rdr.GetString(rdr.GetOrdinal("contactID2")) + " " + rdr.GetString(rdr.GetOrdinal("full_name")) + "
");
ContactID = rdr.GetString(rdr.GetOrdinal("contactID2"));
userName =rdr.GetString(rdr.GetOrdinal("contactID2"));
Password = "password01" //Depending on the settings in the webConfig file the passwords may need to be alpha numeric.
email = rdr.GetString(rdr.GetOrdinal("Email"));
passwordQuestion = "enter your question here?";
passwordAnswer = "enter your answer here";
isApproved = true;

//call the web service here.
rtn = ws.CreateImisUser(false, true, ContactID, userName, Password, email, passwordQuestion, passwordAnswer, true);

}

Error with MembershipService()

I have got this all set up in VS 2008 using C#.  Everything works well except that I get an error on the following line of code:

ws = new Asi.Web.Services.Membership.MembershipWebService();
 

I get the null reference error.

If I comment that out as well as the call to the web service at the bottom, everything works and I get the console.writeline to the console.   Any thoughts?

Thanks!

Steve Russell GI Solutions/Graphic Images Denver

Looks like you need a reference

It looks like you need a reference to the ASI.dll. That dll should be located in the BIN folder of the iMIS Public or Net folder.  Are you getting intellisense when you type that line? That would be a key indicator.

ASI.dll

No, that reference is already added.  In fact I tried several other ASI specific references and none seemed to do the trick.

Make sure the reference to

Make sure the reference to the Membership Web Service is pointing to the right URL, as is the ImisWebServiceUrl in web.config or app.config; you might also try refreshing that reference to make sure it's up to date.

I will give that a shot

But can you please tell me the difference between the two services?  (Relative newbie here with this stuff).   If I comment out the first, the second on works.  What is the difference?  If it were a problem with the reference or URL, wouldn't I have problems with both?  Or am I missing something really simple.  Thanks for your help!

ws = new Asi.Web.Services.Membership.MembershipWebService();
rtn = new Asi.Web.Services.Membership.WebServiceProxyableMembershipUser();

The second one isn't a

The second one isn't a service at all; it's just an object (that can be passed to or returned from a web service) that represents a user. I don't know why it's constructing an empty one at all (I would initialize it to null, myself), but if you comment the ws calls out, it's basically bypassing the web service entirely and just returning the empty user object, rather than the filled one you would get by calling ws.CreateImisUser.

That makes sense now

Thanks.  BTW, I did try to initialize it first it didn't help.  I will check the URLs etc. 

Authenticating web service

I had this working just fine last week in a test/dev environment.  Today I changed the references, modified the SQL connection string and tried to run on a different machine, to simulate a production run, and now, for some reason, it is failing on the call to the web service - Server was unable to process request.---> You must authenticate wit the web service before you can create a user.  I have not been able to get around this and am puzzled why this is a problem now when it wasn't last week?  I have set everything back to how it was last week and continue to get the error.  Any ideas?

Thanks again!

Have you tested to see if

Have you tested to see if you can reach the iMIS application server from the new machine you're running it on?

Yep

No problems there.  I can reach the app server and logon to iMIS without any problems.

"You must authenticate with

"You must authenticate with the web service before you can create a user."

I think it's because you're not logged in.  Try putting this around your code:

   Asi.Web.Services.Membership.MembershipWebService ws;
   ws = new Asi.Web.Services.Membership.MembershipWebService();      

  if (ws.LoginUser("manager", "password", true).Equals(Asi.Web.LogonResultCodes.Succeeded))
        {

 

     }

 

 

I will try that.

Thanks.  I will give that a shot, but that doesn't explain why it was working last week.  I don't believe I did anything different then.

If I replace the

If I replace the "manager","password" in

if (ws.LoginUser("manager", "password", true).Equals(Asi.Web.LogonResultCodes.Succeeded))

with my manager password, it should log me in?  I guess it is not logging me in.  I put the if statement around the While clause and it dumps me right out.

Yes you will need to replace

Yes you will need to replace the login and password with that which matches your database.

Still no good.  I get

Still no good.  I get logged in OK, but I still get the error.  This is the source error:

Line 614:        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://imis.com/webservices/membership/CreateImisUser", RequestNamespace="http://imis.com/webservices/membership", ResponseNamespace="http://imis.com/webservices/membership", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 615:        public WebServiceProxyableMembershipUser CreateImisUser(bool staffUser, bool webUser, string contactID, string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved) {
Line 616:            object[] results = this.Invoke("CreateImisUser", new object[] {
Line 617:                        staffUser,
Line 618:                        webUser,
Source File: C:\Users\steve\Documents\Logons\Logons\Web References\ImisWebService\Reference.cs    Line: 616
 

Can you paste your code?

Can you paste your code?

Sure.  It's pretty much

Sure.  It's pretty much cut-and-paste right from here, but here is my version.  The ImisWebService reference is what I called my web reference when I created it:

sing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data.SqlClient;
using System.Web.Services;
using Asi;
using Asi.Web;
using Asi.Web.Services;

namespace Logons
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
String ContactID;
String userName;
String Password;
String email;
String passwordQuestion;
String passwordAnswer;
String strSQL;
bool isApproved = true;
bool Authenticated = true;

ImisWebService.MembershipWebService ws = null;
ImisWebService.WebServiceProxyableMembershipUser rtn = null;
ws = new ImisWebService.MembershipWebService();
if (ws.LoginUser("manager", "manager123", true).Equals(ImisWebService.LogonResultCodes.Succeeded))
{
Console.WriteLine("We are logged on");

rtn = new ImisWebService.WebServiceProxyableMembershipUser();

SqlConnection con = new SqlConnection("Data Source=gilocalserver1;Initial Catalog=iMIS_NCSL;" +
"User Id=sa; Password=sql;");
con.Open();
strSQL = ("SELECT top 20 n.ID AS contactID, " +
"substring(n.first_name,1,1)+substring(n.last_name,1,1)+cast(n.id as char) as contactID2," +
"n.MEMBER_TYPE, n.full_name, n.EMAIL, n.ZIP " +
"FROM Name AS n " +
"INNER JOIN Name_Security AS ns ON n.ID = ns.ID where web_login = '' " +
"and n.email <> '' and n.status = 'a'");
SqlCommand cmd = new SqlCommand(strSQL, con);
SqlDataReader rdr = null;
rdr = cmd.ExecuteReader();

while (rdr.Read())
{
Console.WriteLine(rdr.GetString(rdr.GetOrdinal("contactID2")) + " " + rdr.GetString(rdr.GetOrdinal("full_name")) + "");
ContactID = rdr.GetString(rdr.GetOrdinal("contactID"));
userName = rdr.GetString(rdr.GetOrdinal("contactID2"));
Password = ContactID + "geowomen";
//Depending on the settings in the webConfig file the passwords may need to be alpha numeric.
email = rdr.GetString(rdr.GetOrdinal("Email"));
passwordQuestion = "Association acronym?";
passwordAnswer = "AWG";
isApproved = true;

//call the web service here.
rtn = ws.CreateImisUser(false, true, ContactID, userName, Password, email, passwordQuestion, passwordAnswer, isApproved);
TextBox1.Text += ContactID + " " + rdr.GetString(rdr.GetOrdinal("full_name")) + " " + userName + " " + Password + Environment.NewLine;

}
//label1.Text = ("Create Logons Completed");
}
}
}
}

Have you upgraded or patched

Have you upgraded or patched iMIS?

That is the single thing

That is the single thing that is different from last week, actually, not that I think about it.  Last week I was hitting against 15.1 RC.  This week I am hitting against 15.0.3, latest patch.

You may need to update the

You may need to update the Web Service reference in VS (if you didn't). The web service changed between 15.0.3 and 15.1, and a proxy generated for 15.1 probably won't work for 15.0.3.

I did.  Actually,

I did.  Actually, I rebuilt the app completely from scratch using the 15.0.3 instance.

Are you sure you changed the

Are you sure you changed the ImisWebServerUrl and DB connection string? Are you sure you put the password in correctly (case matters)?

Well, 99% sure.  I can copy

Well, 99% sure.  I can copy the ImisWebServerURL from the properties dialog box and paste it into a web browser and go to the webservice page.  So I am pretty sure that is OK.  I can connect to the iMIS instance using the same userid and password.  I can connect to the database OK using the db sa and password. 

You might want to try to

You might want to try to test it with manually setting the values instead of using the variables with values in the database. Maybe it's something in your data that is crashing it. Perhaps a blank email address or invalid characters.

Well, maybe, but if I put a

Well, maybe, but if I put a breakpoint in the code and debug it, I see it happen the very first time through the code, regardless whether I use variables or hard coded strings.  Right now  i am uninsgtalling and reinstalling everything on my server to see if by chance I have out of sync dlls or something.

Don't have much hair left as it is......

Completely uninstalled all instances of iMIS15 from the server.  Reinstalled 15.0.3 with patch 2384 (which is where our client is at).  Can connect just fine using desktop, staff, casual views.  Can connect from the workstation I am developing the code on.  No problems.  Deleted the web reference in the code and created it anew.  Replaced the variables in the code with strings and bools, still getting the error.

Try changing this: if

Try changing this:

if (ws.LoginUser("manager", "manager123", true).Equals(ImisWebService.LogonResultCodes.Succeeded))

to this:

ImisWebService.LogonResultCodes result = ws.LoginUser("manager", "manager123", true)
if (result.Equals(ImisWebService.LogonResultCodes.Succeeded))

And use the debugger to check what "result" comes back. If it's something other than "Failed" it might tell you the reason it's failing.

I have gotten back into this

I have gotten back into this tonight and think I may have figured out part of the problem?  If that GUEST logon is not set up correctly in 15.1, I cannot connect to the web service.  Now that I have the Guest logon running (sees to go away on it's own though and have to continually recreate it) I was able to finally get this to work again.

I know several customers

I know several customers have been deleting the GUEST account... which is a bad idea, it's required for the system to function. I would check to make sure noone else is deleting it out of a misguided security mindset.

I am seeing the same thing

I am seeing the same thing in my own dev setup - I am the only one with access.  On the customer sites, I add a not in the address field not to delete, but I have seen this on their sites as well.

Is there an expiration date

Is there an expiration date set on the GUEST account? I think there's a configuration option that will automatically set an expiration date when you create a new login. You can either clear the date entirely or set it to 01/01/3000 to effectively disable it.

Yes, it does get set

Yes, it does get set automatically but it's June 2014 or something like that. 

Steve, the next time it

Steve, the next time it happens, can you execute the following SQL, stick the results in an e-mail and send them to emeans@advsol.com? I'll take a look and see if anything jumps out at me.

Thanks!

 

select * from Name n inner join Name_Security ns on n.ID = ns.ID and ns.WEB_LOGIN = 'GUEST'
select * from ContactMain c inner join UserMain u on c.ContactKey = u.UserKey and u.UserId = 'GUEST' and u.ProviderKey > ''
select * from aspnet_Users u inner join aspnet_Membership m on u.UserId = m.UserId and u.UserName = 'GUEST'
declare @providerKey nvarchar(100)
select @providerKey = ProviderKey from UserMain where UserId = 'GUEST' and ProviderKey > ''
exec asi_UserMainLogin @providerKey

Need to know how to assign roles when generating logins

I am trying to figure out how to assign a user to a role when generating logins. Has anyone tried to do this or can anyone point me in the right direction?

Thanks,

Andie

In 15.1, you can get the

In 15.1, you can get the RoleKey of the role (from RoleMain), and the UserKey of the user (from UserMain) and insert those values into UserRole.

In previous versions, this will only work with Casual/Full users.

Just to verify I'm understanding you correctly

Are you saying this will work in 15.1 and higher?

In 15.1.1 and higher it will

In 15.1.1 and higher it will work for any user: Public, Casual, or Full.

In 15.0.1 and 15.0.3 and lower it will work only for Casual and Full users (but not Public).

ErrorMessage=Specified group is null

     Asi.Business.BusinessContainer container = new Asi.Business.BusinessContainer();

     Guid groupTypeKey = Asi.Business.Common.GroupType.iMISModuleUsers;
     Guid roleTypeKey = Asi.Business.Common.GroupType.iMISModuleUsers;

//This is the "select RoleKey, Name from dbo.RoleMain where Name = 'CompanyAdministrator'"
     Guid roleKey = new Guid("4F0F93A9-00EE-40BA-BCBC-99A5BEB21179");

 Asi.Business.Common.GroupMemberStatus roleMemberStatusController = Asi.Business.Common.GroupMemberStatusController.GroupMemberStatus("A", container);
 Asi.Business.BusinessContainer groupMembercontainer = new Asi.Business.BusinessContainer();
 Asi.Business.Common.GroupMemberController groupMemberController = Asi.Business.Common.GroupMemberController.NewGroupMemberController(groupMembercontainer);
 Asi.Business.Common.GroupMember newGroupMember = groupMemberController.Add(groupTypeKey);

                 
 newGroupMember.AddMemberRole(roleKey, Asi.Business.Common.RoleAddBehavior.UseExistingRole);

//Returns this error.
  ErrorMessage=Specified group is null

at Asi.Business.Common.GroupMemberDetailController.Add(Group group, Guid groupMemberKey, Guid groupRoleKey, DateTime effectiveDate, DateTime expirationDate)
at Asi.Business.Common.GroupMember.AddMemberRole(Guid groupRoleKey, DateTime effectiveDate, DateTime expirationDate, GroupMemberStatus initialRoleStatus, String data, Guid key, Boolean flag, RoleAddBehavior behavior)
at Asi.Business.Common.GroupMember.AddMemberRole(Guid roleKey, RoleAddBehavior behavior)

Bruce M Walker

BSCI

Chicago IL