Hi I get below errors while assigning members as in below code...
// Get the entity member information
.... members = MdsProxy.EntityMembersGet(new International(), getRequest.MembersGetCriteria, out emi, out or);
=>An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. at Oct/22/2013 15:12:52 ->Method Name : exception.
=The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. at Oct/22/2013 15:13:50 ->Method Name : exception.
=>Access is denied. at Oct/22/2013 15:44:09 ->Method Name : exception.
Also the error messages are inconsistent that every time it reports either of the above errors. I had tried below options already
1. Updating service reference -
2. 2. Removing <identity></identity> in web.config file.
Could some one please suggest any other ways to overcome this?
Below code for ref:
private static string GetMemberSearchResult(string modelName, string versionName, string entityName, MemberType memberType, string[][] memberName)
{
string MsgTxt = string.Empty;
MemberIdentifier memberIdentifier = new MemberIdentifier();
// Create the request object to get the entity information.
EntityMembersGetRequest getRequest = new EntityMembersGetRequest();
getRequest.MembersGetCriteria = new EntityMembersGetCriteria();
// Set the modelId, versionId, entityId, and the member name.
getRequest.MembersGetCriteria.ModelId = new Identifier { Name = modelName };
getRequest.MembersGetCriteria.VersionId = new Identifier { Name = versionName };
getRequest.MembersGetCriteria.EntityId = new Identifier { Name = entityName };
getRequest.MembersGetCriteria.MemberType = memberType;
//getRequest.MembersGetCriteria.MemberReturnOption = MemberReturnOption.Data;
getRequest.MembersGetCriteria.MemberReturnOption = MemberReturnOption.DataAndCounts;
OperationResult or = new OperationResult();
EntityMembersInformation emi = new EntityMembersInformation();
EntityMembers members = new EntityMembers();
try
{
string str = string.Empty;
for (int i = 0; i < memberName.Length; i++)
{
ServiceClientRef.Attribute attr = new ServiceClientRef.Attribute();
attr.Identifier = new Identifier() { Name = memberName[i][0] };
attr.Value = memberName[i][1].Trim();
if (attr.Type == AttributeValueType.Domain)
{
MemberIdentifier dbaMemberId = (MemberIdentifier)attr.Value;
attr.Value = dbaMemberId.Code;
}
else
attr.Value = memberName[i][1].Trim();
str = str + string.Format(" [{0}] = '{1}' AND ", memberName[i][0], attr.Value);
}
getRequest.MembersGetCriteria.SearchTerm = string.Format(str.Substring(0, str.Length - 4));
// Get the entity member information
members = mdsProxy.EntityMembersGet(new International(), getRequest.MembersGetCriteria, out emi, out or);
if (members.Members.Count() > 0)
{
MsgTxt = "U"; }
else MsgTxt = "I";
}
catch (Exception ex)
{
MsgTxt = ex.Message;
throw ex;
}
}