Hi all
I have a method which returns a user-defined compelx object ..But this
object in turns contains a java.util.Set that contains complex type
elements. Each of the elements again contains complex type objects. I want
to call this method(LogIn) in .NET front end.
How do I deal with this object here? Following are the partial listing of
the involved classes from the parent to the children:
public abstract class Users implements java.io.Serializable {
protected Set projectRoleColl;
public Set getProjectRoleColl() {
return projectRoleColl;
}
public void setProjectRoleColl(Set projectRoleColl) {
this.projectRoleColl = projectRoleColl;
}
}
public class ProjectRole implements java.io.Serializable {
private Role role;
private Project project;
public Project getProject() {
return project;
}
public Role getRole() {
return role;
}
public void setProject(Project project) {
this.project = project;
}
public void setRole(Role role) {
this.role = role;
}
}
public class Role {
private Long id;
private String roleName;
private Set privilegeColl;
public Long getId() {
return id;
}
public String getRoleName() {
return roleName;
}
public void setId(Long rid) {
id = rid;
}
public void setRoleName(String rName) {
roleName = rName;
}
/**
* Returns the privilegeColl.
* @return Set
*/
public Set getPrivilegeColl() {
return privilegeColl;
}
/**
* Sets the privilegeColl.
* @param privilegeColl The privilegeColl to set
*/
public void setPrivilegeColl(Set privilegeColl) {
this.privilegeColl = privilegeColl;
}
}
public class Project {
private Long id;
private String projectName;
private Set userColl;
public Long getId() {
return id;
}
public String getProjectName() {
return projectName;
}
/**
* Returns the userColl.
* @return Set
*/
public Set getUserColl() {
return userColl;
}
public void setId(Long pid) {
id = pid;
}
public void setProjectName(String pName) {
projectName = pName;
}
/**
* Sets the userColl.
* @param userColl The userColl to set
*/
public void setUserColl(Set userColl) {
this.userColl = userColl;
}
}
Here is my C# client code.
Users o = (Users)svc1.LogIn("sandeep-temp", "", "ftis");
ProjectRole obj = (ProjectRole)o.projectRoleColl;
The code in red generates "System.InvalidCastException" with "Additional
information: Specified cast is not valid." Is there a way to make this
cast valid? Thanks.
Harry Wen